Skip to content

Onboard Azure Advisor MCP Tool - Apply Advisor Recommendations#2686

Merged
alzimmermsft merged 20 commits into
microsoft:mainfrom
ankiga-MSFT:ankiga-MSFT/advisor-mcp-apply-recommendations
May 28, 2026
Merged

Onboard Azure Advisor MCP Tool - Apply Advisor Recommendations#2686
alzimmermsft merged 20 commits into
microsoft:mainfrom
ankiga-MSFT:ankiga-MSFT/advisor-mcp-apply-recommendations

Conversation

@ankiga-MSFT
Copy link
Copy Markdown
Member

@ankiga-MSFT ankiga-MSFT commented May 20, 2026

What does this PR do?

Add Azure Advisor MCP Tool - Apply Advisor Recommendations

GitHub issue number?

2685

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
    • Created a changelog entry if the change falls among the following: new feature, bug fix, UI/UX update, breaking change, or updated dependencies. Follow the changelog entry guide
  • 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
    • Validate README.md changes running the script ./eng/scripts/Process-PackageReadMe.ps1. See Package README
    • 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 tools with new names, including new tools or renamed tools, update consolidated-tools.json
    • For renamed tools, follow the Tool Rename Checklist and tag the PR with the breaking-change label
    • 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 command list in servers/Azure.Mcp.Server/docs/azmcp-commands.md
    • Ran ./eng/scripts/Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • Updated test prompts in servers/Azure.Mcp.Server/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

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 onboards an Azure Advisor MCP tool command (azmcp advisor recommendation apply) that returns embedded “apply recommendation” rule definitions for a set of Azure resource types, along with unit tests and server/docs registration.

Changes:

  • Added RecommendationApplyCommand (+ options + JSON source-gen support) to return embedded rule JSON by --resource.
  • Added embedded Resources/*.json rule definitions for multiple Azure resource types.
  • Wired the tool into Azure MCP Server metadata/docs and added unit tests for the new command.

Invoking Livetests

Copilot submitted PRs are not trustworthy by default. Users with write access to the repo need to validate the contents of this PR before leaving a comment with the text /azp run mcp - pullrequest - live. This will trigger the necessary livetest workflows to complete required validation.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
tools/Azure.Mcp.Tools.Advisor/src/Commands/Recommendation/RecommendationApplyCommand.cs New “apply” command that validates --resource, loads embedded JSON, and caches results.
tools/Azure.Mcp.Tools.Advisor/src/Options/Recommendation/RecommendationApplyOptions.cs Options POCO for the apply command.
tools/Azure.Mcp.Tools.Advisor/src/Options/Recommendation/RecommendationApplyOptionDefinitions.cs Defines the --resource option and help text.
tools/Azure.Mcp.Tools.Advisor/src/Commands/AdvisorJsonContext.cs Adds source-gen support for List<string> responses.
tools/Azure.Mcp.Tools.Advisor/src/AdvisorSetup.cs Registers the new command in DI and command group.
tools/Azure.Mcp.Tools.Advisor/tests/Azure.Mcp.Tools.Advisor.Tests/Recommendation/RecommendationApplyCommandTests.cs Unit tests covering metadata, validation, deserialization, and caching behavior.
tools/Azure.Mcp.Tools.Advisor/src/Resources/aad_domainservices.json New embedded rule definitions for Entra Domain Services.
tools/Azure.Mcp.Tools.Advisor/src/Resources/apimanagement_service.json New embedded rule definitions for API Management.
tools/Azure.Mcp.Tools.Advisor/src/Resources/cognitiveservices_accounts.json New embedded rule definitions for Cognitive Services accounts.
tools/Azure.Mcp.Tools.Advisor/src/Resources/compute_virtualmachines.json New embedded rule definitions for VMs.
tools/Azure.Mcp.Tools.Advisor/src/Resources/compute_virtualmachinescalesets.json New embedded rule definitions for VM scale sets.
tools/Azure.Mcp.Tools.Advisor/src/Resources/containerregistry_registries.json New embedded rule definitions for ACR.
tools/Azure.Mcp.Tools.Advisor/src/Resources/containerservice_managedclusters.json New embedded rule definitions for AKS clusters.
tools/Azure.Mcp.Tools.Advisor/src/Resources/dbforpostgresql_flexibleservers.json New embedded rule definitions for PostgreSQL flexible servers.
tools/Azure.Mcp.Tools.Advisor/src/Resources/documentdb_databaseaccounts.json New embedded rule definitions for Cosmos DB accounts.
tools/Azure.Mcp.Tools.Advisor/src/Resources/keyvault_vaults.json New embedded rule definitions for Key Vault.
tools/Azure.Mcp.Tools.Advisor/src/Resources/kubernetes_connectedclusters.json New embedded rule definitions for Arc connected clusters.
tools/Azure.Mcp.Tools.Advisor/src/Resources/kubernetesconfiguration_extensions.json New embedded rule definitions for Kubernetes extensions.
tools/Azure.Mcp.Tools.Advisor/src/Resources/netapp_volumes.json New embedded rule definitions for NetApp volumes.
tools/Azure.Mcp.Tools.Advisor/src/Resources/network_applicationgatewaywebapplicationfirewallpolicies.json New embedded rule definitions for App Gateway WAF policies.
tools/Azure.Mcp.Tools.Advisor/src/Resources/network_expressrouteports.json New embedded rule definitions for ExpressRoute ports.
tools/Azure.Mcp.Tools.Advisor/src/Resources/network_frontdoorwebapplicationfirewallpolicies.json New embedded rule definitions for Front Door WAF policies.
tools/Azure.Mcp.Tools.Advisor/src/Resources/sql_managedinstances.json New embedded rule definitions for SQL managed instances.
tools/Azure.Mcp.Tools.Advisor/src/Resources/storage_storageaccounts.json New embedded rule definitions for Storage accounts.
tools/Azure.Mcp.Tools.Advisor/src/Resources/web_serverfarms.json New embedded rule definitions for App Service plans.
tools/Azure.Mcp.Tools.Advisor/src/Resources/web_staticsites.json New embedded rule definitions for Static Web Apps.
servers/Azure.Mcp.Server/src/Resources/consolidated-tools.json Adds the new tool mapping (advisor_recommendation_apply) to the consolidated tool catalog.
servers/Azure.Mcp.Server/docs/azmcp-commands.md Documents the new CLI command usage.

Comment thread tools/Azure.Mcp.Tools.Advisor/src/Resources/web_serverfarms.json Outdated
Comment thread servers/Azure.Mcp.Server/docs/azmcp-commands.md Outdated
@ankiga-MSFT
Copy link
Copy Markdown
Member Author

Results from Tool description evaluator run -

🎯 Filtering prompts to area: Advisor
📝 Using default prompts file (e2eTestPrompts.md) for Azure.Mcp.Server
💾 Saved prompts to prompts.json
🧪 Tested 5 prompts:
📊 Top choice: 100.0%
💪 Very High confidence (≥0.8): 0.0%
🎯 High confidence (≥0.7): 0.0%
✅ Good confidence (≥0.6): 100.0%
👍 Fair confidence (≥0.5): 100.0%
👌 Acceptable confidence (≥0.4): 100.0%
⭐ Top + acceptable confidence (≥0.4): 100.0%
🎯 Tool selection analysis completed
📊 Results written to: D:\msft-advisor-mcp\eng\tools\ToolDescriptionEvaluator\results.md
⏱️ Total execution time: 14.0659464s

Expected Tool: advisor_recommendation_apply
Prompt: Apply Advisor recommendations to this ARM template

Results

Rank Score Tool Status
1 0.632157 advisor_recommendation_apply EXPECTED
2 0.523744 advisor_recommendation_list
3 0.459641 azureterraformbestpractices_get
4 0.435818 deploy_pipeline_guidance_get
5 0.429113 get_azure_bestpractices_get

Expected Tool: advisor_recommendation_apply
Prompt: Apply Advisor recommendations to this Terraform file for Storage Account

Results

Rank Score Tool Status
1 0.617697 advisor_recommendation_apply EXPECTED
2 0.508354 azureterraformbestpractices_get
3 0.504128 fileshares_rec
4 0.473977 advisor_recommendation_list
5 0.413549 azurebackup_vault_update

1 similar comment
@ankiga-MSFT
Copy link
Copy Markdown
Member Author

Results from Tool description evaluator run -

🎯 Filtering prompts to area: Advisor
📝 Using default prompts file (e2eTestPrompts.md) for Azure.Mcp.Server
💾 Saved prompts to prompts.json
🧪 Tested 5 prompts:
📊 Top choice: 100.0%
💪 Very High confidence (≥0.8): 0.0%
🎯 High confidence (≥0.7): 0.0%
✅ Good confidence (≥0.6): 100.0%
👍 Fair confidence (≥0.5): 100.0%
👌 Acceptable confidence (≥0.4): 100.0%
⭐ Top + acceptable confidence (≥0.4): 100.0%
🎯 Tool selection analysis completed
📊 Results written to: D:\msft-advisor-mcp\eng\tools\ToolDescriptionEvaluator\results.md
⏱️ Total execution time: 14.0659464s

Expected Tool: advisor_recommendation_apply
Prompt: Apply Advisor recommendations to this ARM template

Results

Rank Score Tool Status
1 0.632157 advisor_recommendation_apply EXPECTED
2 0.523744 advisor_recommendation_list
3 0.459641 azureterraformbestpractices_get
4 0.435818 deploy_pipeline_guidance_get
5 0.429113 get_azure_bestpractices_get

Expected Tool: advisor_recommendation_apply
Prompt: Apply Advisor recommendations to this Terraform file for Storage Account

Results

Rank Score Tool Status
1 0.617697 advisor_recommendation_apply EXPECTED
2 0.508354 azureterraformbestpractices_get
3 0.504128 fileshares_rec
4 0.473977 advisor_recommendation_list
5 0.413549 azurebackup_vault_update

Comment thread tools/Azure.Mcp.Tools.Advisor/src/Resources/aad_domainservices.json
@github-project-automation github-project-automation Bot moved this from Untriaged to In Progress in Azure MCP Server May 28, 2026
@alzimmermsft alzimmermsft merged commit 9fca387 into microsoft:main May 28, 2026
13 of 15 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Azure MCP Server May 28, 2026
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.

3 participants