Skip to content

Migrate List Activity Logs tool from @azure to azure monitor command group in az mcp server#720

Merged
msalaman merged 31 commits intomainfrom
masalama/activityLogTool
Oct 9, 2025
Merged

Migrate List Activity Logs tool from @azure to azure monitor command group in az mcp server#720
msalaman merged 31 commits intomainfrom
masalama/activityLogTool

Conversation

@msalaman
Copy link
Copy Markdown
Contributor

@msalaman msalaman commented Oct 7, 2025

What does this PR do?

Added List Activity Logs command that list the activity logs of a given Azure resource
Activity Log Documentation: https://learn.microsoft.com/en-us/azure/azure-monitor/platform/activity-log?tabs=log-analytics
image

GitHub issue number?

[Link to the GitHub issue this PR addresses]

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history is clean with descriptive messages (cleanup guide)
    • Added comprehensive tests for new/modified functionality
    • Updated servers/Azure.Mcp.Server/CHANGELOG.md and/or servers/Fabric.Mcp.Server/CHANGELOG.md for product changes (features, bug fixes, UI/UX, updated dependencies)
  • For MCP tool changes:
    • One tool per PR: This PR adds or modifies only one MCP tool for faster review cycles
    • Updated servers/Azure.Mcp.Server/README.md and/or servers/Fabric.Mcp.Server/README.md documentation
    • Updated command list in /docs/azmcp-commands.md and/or /docs/fabric-commands.md
    • For new or modified tool descriptions, ran ToolDescriptionEvaluator and obtained a score of 0.4 or more and a top 3 ranking for all related test prompts
    • For new tools associated with Azure services or publicly available tools/APIs/products, add URL to documentation in the PR description
  • Extra steps for Azure MCP Server tool changes:
    • Updated test prompts in /docs/e2eTestPrompts.md
    • 👉 For Community (non-Microsoft team member) PRs:
      • Security review: Reviewed code for security vulnerabilities, malicious code, or suspicious activities before running tests (crypto mining, spam, data exfiltration, etc.)
      • Manual tests run: added comment /azp run mcp - pullrequest - live to run Live Test Pipeline

@msalaman msalaman marked this pull request as ready for review October 7, 2025 19:04
@msalaman msalaman requested review from a team, jongio and srnagar as code owners October 7, 2025 19:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new Activity Log List command to the Azure Monitor command group, allowing users to retrieve activity logs for Azure resources. The command provides filtering capabilities by time range, event level, and result count.

Key changes:

  • New activity log command implementation with comprehensive test coverage
  • Integration with Azure Management API for activity log retrieval
  • Service layer extension to support activity log operations

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ActivityLogListCommandTests.cs Comprehensive unit tests for the new activity log list command
MonitorService.cs Extended service with activity log API integration and HTTP client support
IMonitorService.cs Interface extension for activity log operations
ActivityLogOptionDefinitions.cs Command option definitions for activity log parameters
ActivityLogListOptions.cs Options class for activity log command parameters
MonitorSetup.cs Service registration and command group configuration
ActivityLogLocalizableString.cs Model for localizable string properties in activity logs
ActivityLogListResponse.cs Response model for activity log API calls
ActivityLogEventLevel.cs Enumeration for activity log event levels
ActivityLogEventData.cs Main data model for individual activity log events
MonitorJsonContext.cs JSON serialization context updates for new models
ActivityLogListCommand.cs Main command implementation for listing activity logs
e2eTestPrompts.md Test prompt addition for new command
azmcp-commands.md Documentation update with new command usage
CHANGELOG.md Release notes for the new feature
prompts.json Tool description evaluator prompt configuration
launch.json Debug configuration for the new command
cspell.json Spelling dictionary update

Comment thread .vscode/launch.json Outdated
Comment thread tools/Azure.Mcp.Tools.Monitor/src/Services/IMonitorService.cs Outdated
Comment thread tools/Azure.Mcp.Tools.Monitor/src/Services/MonitorService.cs
Comment thread tools/Azure.Mcp.Tools.Monitor/src/Services/MonitorService.cs Outdated
@joshfree joshfree moved this from Untriaged to In Progress in Azure MCP Server Oct 7, 2025
msalaman and others added 2 commits October 7, 2025 14:48
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Update default value

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread tools/Azure.Mcp.Tools.Monitor/src/Services/MonitorService.cs Outdated
Comment thread tools/Azure.Mcp.Tools.Monitor/src/Services/MonitorService.cs
Comment thread tools/Azure.Mcp.Tools.Monitor/src/Services/MonitorService.cs Outdated
Comment thread .vscode/launch.json Outdated
Comment thread servers/Azure.Mcp.Server/docs/e2eTestPrompts.md
Comment thread tools/Azure.Mcp.Tools.Monitor/src/Commands/ActivityLog/ActivityLogListCommand.cs Outdated
Comment thread tools/Azure.Mcp.Tools.Monitor/src/Services/IMonitorService.cs
@msalaman msalaman mentioned this pull request Oct 8, 2025
17 tasks
@msalaman msalaman requested a review from jongio October 8, 2025 23:44
Comment thread tools/Azure.Mcp.Tools.Monitor/src/Services/MonitorService.cs Outdated
Comment thread tools/Azure.Mcp.Tools.Monitor/src/Services/MonitorService.cs Outdated
@msalaman msalaman requested a review from jongio October 9, 2025 14:42
Comment thread .vscode/launch.json Outdated
Comment thread tools/Azure.Mcp.Tools.Monitor/src/Services/MonitorService.cs Outdated
@msalaman msalaman requested a review from jongio October 9, 2025 15:44
@msalaman msalaman merged commit a68846a into main Oct 9, 2025
27 checks passed
@msalaman msalaman deleted the masalama/activityLogTool branch October 9, 2025 19:39
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Azure MCP Server Oct 9, 2025
colbytimm pushed a commit to colbytimm/microsoft-mcp that referenced this pull request Dec 8, 2025
…group in az mcp server (microsoft#720)

* implementation of activitylog tool

* fix activity log implementation

* fix build issues

* remove unnecessary file

* clean up outdated file

* updated activitylog command to complement newer changes to azure mcp

* cleanup tests

* restore tools.json

* Update .vscode/launch.json spelling

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update tools/Azure.Mcp.Tools.Monitor/src/Services/IMonitorService.cs

Update default value

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update tools/Azure.Mcp.Tools.Monitor/src/Services/MonitorService.cs

Improving readability per copilot's suggestion

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix test

* update monitor service to use IhttpclientService

* update parameters in launch json

* refactor command to latest design

* removed duplicate defaults

* fix null scenario unit test

* update parameters to correspond with validaterequired param changes

* added token caching

* updated to use primary constructor

* make token caching reusable

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants