-
Notifications
You must be signed in to change notification settings - Fork 344
Add Azure Policy Tool #1483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Azure Policy Tool #1483
Conversation
… azurebestpractices to check for policies
There was a problem hiding this 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 Azure Policy tool to the Azure MCP Server that enables listing policy assignments for Azure subscriptions and scopes. The tool integrates with the Azure Best Practices guidance to help ensure generated code complies with organizational policies.
Changes:
- Added new Azure Policy tool with
policy assignment listcommand - Updated Azure Best Practice tool instructions to incorporate policy checking in code generation and deployment workflows
- Added tool to consolidated tools registry and server configuration
Reviewed changes
Copilot reviewed 30 out of 32 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/Azure.Mcp.Tools.Policy/src/Azure.Mcp.Tools.Policy.csproj | Project file for new Policy tool |
| tools/Azure.Mcp.Tools.Policy/src/Services/PolicyService.cs | Service implementation for listing policy assignments |
| tools/Azure.Mcp.Tools.Policy/src/Services/IPolicyService.cs | Service interface definition |
| tools/Azure.Mcp.Tools.Policy/src/Commands/Assignment/PolicyAssignmentListCommand.cs | Command implementation for listing policy assignments |
| tools/Azure.Mcp.Tools.Policy/src/Commands/PolicyJsonContext.cs | JSON serialization context for AOT compatibility |
| tools/Azure.Mcp.Tools.Policy/src/Models/PolicyAssignment.cs | Model for policy assignment data |
| tools/Azure.Mcp.Tools.Policy/src/Models/PolicyDefinition.cs | Model for policy definition data |
| tools/Azure.Mcp.Tools.Policy/src/Options/Assignment/PolicyAssignmentListOptions.cs | Options for list command |
| tools/Azure.Mcp.Tools.Policy/src/Options/PolicyOptionDefinitions.cs | Shared option definitions |
| tools/Azure.Mcp.Tools.Policy/src/Options/BasePolicyOptions.cs | Base options class |
| tools/Azure.Mcp.Tools.Policy/src/Options/Assignment/AssignmentGetOptions.cs | Options for future get command |
| tools/Azure.Mcp.Tools.Policy/src/PolicySetup.cs | Service registration and command setup |
| tools/Azure.Mcp.Tools.Policy/tests/Azure.Mcp.Tools.Policy.UnitTests/Assignment/PolicyAssignmentListCommandTests.cs | Unit tests for list command |
| tools/Azure.Mcp.Tools.AzureBestPractices/src/Resources/azure-general-deployment-best-practices.txt | Updated to include policy checking step |
| tools/Azure.Mcp.Tools.AzureBestPractices/src/Resources/azure-general-codegen-best-practices.txt | Updated to include policy checking step |
| tools/Azure.Mcp.Tools.AzureBestPractices/src/Resources/azure-functions-deployment-best-practices.txt | Updated to include policy checking step |
| tools/Azure.Mcp.Tools.AzureBestPractices/src/Resources/azure-functions-codegen-best-practices.txt | Updated to include policy checking step |
| servers/Azure.Mcp.Server/src/Program.cs | Registered Policy tool in server |
| servers/Azure.Mcp.Server/docs/e2eTestPrompts.md | Added test prompts for Policy tool |
| servers/Azure.Mcp.Server/docs/azmcp-commands.md | Added command documentation |
| servers/Azure.Mcp.Tools.Policy/src/GlobalUsings.cs | Global using statements |
| servers/Azure.Mcp.Tools.Policy/tests/Azure.Mcp.Tools.Policy.UnitTests/GlobalUsings.cs | Global using statements for tests |
| core/Azure.Mcp.Core/src/Areas/Server/Resources/consolidated-tools.json | Added Policy tool to consolidated tools registry |
| .github/CODEOWNERS | Added code ownership for Policy tool |
tools/Azure.Mcp.Tools.Policy/src/Options/Assignment/AssignmentGetOptions.cs
Outdated
Show resolved
Hide resolved
...Azure.Mcp.Tools.AzureBestPractices/src/Resources/azure-general-deployment-best-practices.txt
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.AzureBestPractices/src/Resources/azure-general-codegen-best-practices.txt
Outdated
Show resolved
Hide resolved
...ure.Mcp.Tools.AzureBestPractices/src/Resources/azure-functions-deployment-best-practices.txt
Outdated
Show resolved
Hide resolved
.../Azure.Mcp.Tools.AzureBestPractices/src/Resources/azure-functions-codegen-best-practices.txt
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.Policy/src/Options/Assignment/AssignmentGetOptions.cs
Outdated
Show resolved
Hide resolved
....Tools.Policy/tests/Azure.Mcp.Tools.Policy.UnitTests/Azure.Mcp.Tools.Policy.UnitTests.csproj
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…unctions-codegen-best-practices.txt Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
...Azure.Mcp.Tools.AzureBestPractices/src/Resources/azure-general-deployment-best-practices.txt
Show resolved
Hide resolved
…GetOptions.cs Co-authored-by: Copilot <[email protected]>

What does this PR do?
Add Azure Policy Tool (https://learn.microsoft.com/en-us/azure/governance/policy/overview) with command that lists Azure policy assignments and corresponding definitions for a given subscription/scope.
Update Azure Best Practice tool instructions to invoke Azure policy tool and use policies to help guide code generation/deployment
GitHub issue number?
#504
Pre-merge Checklist
servers/Azure.Mcp.Server/CHANGELOG.mdand/orservers/Fabric.Mcp.Server/CHANGELOG.mdfor product changes (features, bug fixes, UI/UX, updated dependencies)servers/Azure.Mcp.Server/README.mdand/orservers/Fabric.Mcp.Server/README.mddocumentationeng/scripts/Process-PackageReadMe.ps1. See Package README/servers/Azure.Mcp.Server/docs/azmcp-commands.mdand/or/docs/fabric-commands.md.\eng\scripts\Update-AzCommandsMetadata.ps1to update tool metadata in azmcp-commands.md (required for CI)ToolDescriptionEvaluator]consolidated-tools.json/servers/Azure.Mcp.Server/docs/e2eTestPrompts.mdcrypto mining, spam, data exfiltration, etc.)/azp run mcp - pullrequest - liveto run Live Test Pipeline