Repository navigation
Update optimization tools - #3899
Merged
Merged
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Query correctness, tenant scoping, recorded-test assets, and required evaluator evidence remain unresolved.
6 open findings
Retain impact in the final projection · New Enumerate all tenants for subscriptionless requests · New Update recorded assets for the additional Resource Graph request · New Apply suppression and exclusion filters to summary counts · New Align release notes with the actual response contract · New Provide ToolDescriptionEvaluator evidence for description changes · New
What changed in this PR
Updates optimization recommendation tools to support subscriptionless queries, summarize unattached disks, and revise recommendation terminology.
Changes:
- Makes
--subscriptionoptional for recommendation listing. - Adds unattached-disk summaries and retail-savings fallback logic.
- Updates tool descriptions, tests, documentation, and changelog.
| File | Description |
|---|---|
DiskRecommendationSummaryTests.cs |
Tests disk summary generation and queries. |
RecommendationListCommandTests.cs |
Tests optional subscription and summary output. |
OptimizationStrings.cs |
Adds optional-subscription guidance. |
OptimizationService.cs |
Adds unscoped queries and disk summaries. |
OptimizationKqlQueries.cs |
Updates recommendation queries and projections. |
IOptimizationService.cs |
Makes subscription nullable. |
RecommendationListOptions.cs |
Uses optional-subscription description. |
RecommendationExplainOptions.cs |
Revises resource ID guidance. |
RecommendationAlternativesOptions.cs |
Revises resource ID guidance. |
OptimizationSetup.cs |
Updates optimization terminology. |
DiskRecommendationSummary.cs |
Defines the new summary model. |
CostSavingsResult.cs |
Adds disk summary output. |
CostSavingsRecommendation.cs |
Updates model documentation. |
AlternativeRecommendation.cs |
Updates model terminology. |
RecommendationListCommand.cs |
Supports optional scope and summary output. |
RecommendationExplainCommand.cs |
Revises tool description. |
RecommendationAlternativesCommand.cs |
Revises tool description. |
OptimizationJsonContext.cs |
Registers the summary for AOT serialization. |
e2eTestPrompts.md |
Adds an all-subscriptions prompt. |
azmcp-commands.md |
Documents optional subscription scope. |
optimization-tool-update.yaml |
Records user-facing changes. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Author
|
Updated changes with feedback from copilot |
msalaman
approved these changes
Oct 13, 2026
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What does this PR do?
Updates the Azure MCP Optimization toolset (
optimization recommendation list,explain,alternatives):optimization recommendation list– subscription is now optional. The command now derives fromAuthenticatedCommandinstead ofSubscriptionCommand. When--subscriptionis omitted, the query covers all accessible subscriptions in the signed-in session's default tenant, or in the--tenanttenant (ID or display name) when one is given. The tool never asks for a tenant. Unknown tenant or subscription names now return 404 instead of 500.ArmClientcreated for the target tenant. Previously aTenantResourcewas picked from the default client, so the token always came from the default tenant and tenant display names were ignored.48eda464-1485-4dcf-a674-d0905df5054a). A newUnattachedDiskSummaryQueryruns in parallel and returns onediskRecommendationSummarywith a count, the affected subscription IDs, and a portalactionUrl. It applies the same tracked, suppression, and subscription/resource-group exclusion filters as the main list, through shared KQL subqueries. If the summary query fails, the error is logged and the main list is still returned.extendedPropertieshas no savings amounts, monthly/annual savings and currency now come fromproperties.savings.retail.dailyPotentialSavings/providerCurrency.impactis still projected for every recommendation. The explain query projectsid,resourceGroup,subscriptionId, andpropertieswithimpactremoved.azmcp-commands.md, added an e2e prompt for the all-subscriptions case, added a changelog entry, and added unit tests (DiskRecommendationSummaryTests, updatedRecommendationListCommandTests).GitHub issue number?
[Link to the GitHub issue this PR addresses]Pre-merge Checklist
servers/Azure.Mcp.Server/README.mdand/orservers/Fabric.Mcp.Server/README.mddocumentationREADME.mdchanges running the script./eng/scripts/Process-PackageReadMe.ps1. See Package READMEToolDescriptionEvaluatorand obtained a score of0.4or more and a top 3 ranking for all related test promptsconsolidated-tools.json— N/A, no new or renamed toolsbreaking-changelabel — N/A, no renamed toolsservers/Azure.Mcp.Server/docs/azmcp-commands.md./eng/scripts/Update-AzCommandsMetadata.ps1to update tool metadata inazmcp-commands.md(required for CI)servers/Azure.Mcp.Server/docs/e2eTestPrompts.mdcrypto mining, spam, data exfiltration, etc.)/azp run mcp - pullrequest - liveto run Live Test PipelineValidation
dotnet testinAzure.Mcp.Tools.Optimization.TestswithTestMode: Playback(unit + recorded)azmcp optimization recommendation list --top 5(no--subscription/--tenant, live)impact; disk summary of 25 disks in 4 subscriptionsdotnet test --filter-class "*OptimizationCommandTests"withTestMode: Recordagainst the test subscriptionAzure.Mcp.Tools.Optimization.Tests_b02258d127(assets.jsonupdated)dotnet build servers/Azure.Mcp.Server/srcdotnet format tools/Azure.Mcp.Tools.Optimization/srcand.../tests/...with--verify-no-changes./eng/scripts/Update-AzCommandsMetadata.ps1.\eng\common\spelling\Invoke-Cspell.ps1 -FileList <changed files>ToolDescriptionEvaluatorAOAI_ENDPOINT/TEXT_EMBEDDING_API_KEYavailable locally; the CI step also skips without them