Skip to content

Add service group support to Advisor recommendation summaries - #3799

Merged
Vinay Gera (g2vinay) merged 4 commits into
microsoft:devfrom
ravigupta99:guptaravi/advisor-summary-service-group-dev
Sep 30, 2026
Merged

Vinay Gera (g2vinay) merged 4 commits into
microsoft:devfrom
ravigupta99:guptaravi/advisor-summary-service-group-dev

Conversation

@ravigupta99

Copy link
Copy Markdown
Member

What does this PR do?

Extends the existing advisor recommendation summary tool so the same MCP tool can summarize either subscription-scoped or Azure service-group-scoped Advisor recommendations.

This PR targets dev because main is under code freeze. The Azure MCP team will handle the subsequent uplift from dev to main.

The unified summary tool:

  • Accepts --subscription or --service-group and rejects requests that explicitly provide both.
  • Preserves configured-default subscription behavior when neither scope is supplied.
  • Rejects --resource-group with service-group scope instead of silently ignoring an ambiguous filter.
  • Accepts the repository-standard globally unique service-group ID segment and queries the exact ARG pivot:
    properties.serviceGroupId =~ "/providers/Microsoft.Management/serviceGroups/{serviceGroup}".
  • Keeps subscription summaries and recommendation list on the existing isempty(properties.serviceGroupId) population.
  • Runs service-group queries at tenant scope without adding request-level subscriptions, so the pivot can span subscriptions.
  • Reuses all existing grouping, metadata enrichment, filtering, ordering, truncation, top, and response logic.
  • Preserves the existing summary command ID and { key, label, count } response contract.
  • Adds nullable serviceGroupId to the shared recommendation properties model for update and future list reuse.

The change also extracts the subscription-or-service-group binding and validation introduced by #3798 into RecommendationScopeCommand<TOptions, TResult>. Both update and summary now share explicit option-presence handling, default-subscription resolution, mutual exclusion, and service-group ID validation. The merged update tool's behavior remains unchanged.

Branch and dependency status

Validation completed against latest dev

  • 434/434 Azure Advisor tests passed.
  • Azure MCP Server build passed with zero warnings and errors.
  • Advisor formatting verification passed.
  • Repository spelling validation passed.
  • Command metadata regenerated from the current binary: 415 tools.
  • README package validation passed.
  • Exact local azmcp.exe and independent tenant-scoped ARG validation: 23/23 passed.
    • Current ARG populations:
      • contoso-storefront: 3,665 total / 2,291 active recommendations.
      • commerce: 3,664 total / 2,288 active recommendations.
      • payment-processing-contoso-financial-services: 3,535 total / 2,218 active recommendations.
    • The tested commerce population spans two subscriptions.
    • All seven grouping dimensions matched independent ARG totals and buckets.
    • Category, impact, recommendation type, resource type, resource, search, subcategory, retirement-date, and combined impact/resource-type filters matched independent ARG.
    • Explicit tenant, top, subscription regression, dual-scope rejection, resource-group/SG rejection, blank SG, and invalid SG path cases passed.
  • ToolDescriptionEvaluator against the current 415-tool catalog:
    • 29/29 summary prompts ranked in the top three.
    • Score range: 0.424563–0.600615.
    • All eight service-group summary prompts ranked first.
    • The temporary Entra bearer-token evaluator patch was reversed and evaluator source files were verified clean.
  • Focused Vally service-group routing: 7/7 passed.
  • Build-Local.ps1 -VerifyNpx passed; all server publishes, npm packaging, cache cleanup, and Azure/Fabric/Template npm tool-list invocations completed without inner command failures.
  • NativeAOT was attempted with Build-Local.ps1 -IncludeNative. The inner Azure MCP native publish remains blocked by the existing Cosmos Microsoft.Azure.Documents.JsonSerializable IL2026/IL3050/MSB3077 diagnostics; no Advisor-specific NativeAOT diagnostic was reported.
  • Changelog compilation dry-run validated all entries and produced the expected 3.0.0-beta.48 output.

Public references

GitHub issue number?

Follow-up to #3520. The update prerequisite was delivered to dev through #3798. Supersedes #3604.

Azure DevOps PBI: https://dev.azure.com/msazure/One/_workitems/edit/39592401

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history separates shared scope refactor, implementation/tests, documentation, and dev-convention alignment
    • Added comprehensive tests for new/modified functionality
    • Created a changelog entry
  • For MCP tool changes:
    • Primary behavior change is limited to advisor_recommendation_summary; update changes are a behavior-preserving shared refactor
    • Updated servers/Azure.Mcp.Server/README.md
    • Validated README changes using Process-PackageReadMe.ps1
    • ToolDescriptionEvaluator score is at least 0.4 with top-three ranking for every summary prompt
    • Updated consolidated-tools.json
    • Added public Azure Service Groups documentation
  • Extra steps for Azure MCP Server tool changes:
    • Updated servers/Azure.Mcp.Server/docs/azmcp-commands.md
    • Ran Update-AzCommandsMetadata.ps1
    • Updated servers/Azure.Mcp.Server/docs/e2eTestPrompts.md using current escaped-input conventions

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.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@g2vinay
Vinay Gera (g2vinay) merged commit 8178dc8 into microsoft:dev Sep 30, 2026
10 checks passed
Vinay Gera (g2vinay) added a commit that referenced this pull request Oct 14, 2026
* Extend Advisor recommendation update to service groups (#3798)

* Add service group support to Advisor recommendation summaries (#3799)

* Extend Advisor recommendation list to service groups (#3691)

* Extend Advisor recommendation list to service groups

* Replace --mode enum with --prioritized boolean for Advisor recommendation list

* Updated descriptions, added new e2e tests and simplified scope validation

* refactor(advisor): join recommendation metadata in Resource Graph query

Move metadata enrichment and prioritized ranking server-side, simplify client processing, and update query tests.

* docs: expand Advisor recommendation list E2E prompts

* fix(advisor): align list prioritization and truncation

* Retain instance\-specific values for Personalized/Review recommendations

* Refine recommendation ranking and result truncation

* docs(advisor): clarify prioritized recommendation ordering

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

---------

Co-authored-by: Koushik B <koushikb@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix Speech endpoint placeholder link

Render the example endpoint as inline code so Markdown link verification does not treat the placeholder host as a live URL.

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

---------

Co-authored-by: Ravi Gupta <44098228+ravigupta99@users.noreply.github.com>
Co-authored-by: Koushik <50052906+koushik137@users.noreply.github.com>
Co-authored-by: Koushik B <koushikb@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants