Skip to content

Accept tenant when calling Azure Resource Graph queries#1945

Open
alzimmermsft wants to merge 3 commits intomicrosoft:mainfrom
alzimmermsft:UseTenantInBaseAzureResourceService
Open

Accept tenant when calling Azure Resource Graph queries#1945
alzimmermsft wants to merge 3 commits intomicrosoft:mainfrom
alzimmermsft:UseTenantInBaseAzureResourceService

Conversation

@alzimmermsft
Copy link
Contributor

What does this PR do?

Accept tenant when calling Azure Resource Graph queries to allow configuring both tenant and subscription.

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
    • Validate README.md changes using script at eng/scripts/Process-PackageReadMe.ps1. See Package README
    • Updated command list in /servers/Azure.Mcp.Server/docs/azmcp-commands.md and/or /docs/fabric-commands.md
    • Run .\eng\scripts\Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • 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 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 /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
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 extends Azure Resource Graph (ARG) query execution to accept an optional tenant, enabling callers to scope queries by both tenant and subscription.

Changes:

  • Adds an optional tenant parameter to BaseAzureResourceService.ExecuteResourceQueryAsync and uses it when resolving the subscription/tenant context.
  • Refactors single-resource ARG querying to reuse the multi-result query path.
  • Plumbs tenant through ARG query calls in several tool services (Storage, Kusto, Grafana, Authorization, AppConfig, ACR).

Reviewed changes

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

Show a summary per file
File Description
tools/Azure.Mcp.Tools.Storage/src/Services/StorageService.cs Passes tenant into ARG list/single queries for storage accounts.
tools/Azure.Mcp.Tools.Kusto/src/Services/KustoService.cs Passes tenant into ARG list/single queries for Kusto clusters.
tools/Azure.Mcp.Tools.Grafana/src/Services/GrafanaService.cs Passes tenant into ARG workspace listing.
tools/Azure.Mcp.Tools.Authorization/src/Services/AuthorizationService.cs Passes tenantId into ARG role assignment listing.
tools/Azure.Mcp.Tools.AppConfig/src/Services/AppConfigService.cs Passes tenant into ARG store listing (but not yet into store lookup used by other operations).
tools/Azure.Mcp.Tools.Acr/src/Services/AcrService.cs Passes tenant into ARG registry list/single queries.
core/Azure.Mcp.Core/src/Services/Azure/BaseAzureResourceService.cs Adds tenant support to ARG query execution and refactors single-query path.

@alzimmermsft alzimmermsft added this to the 2026-03 milestone Mar 10, 2026
@alzimmermsft alzimmermsft moved this from Untriaged to In Progress in Azure MCP Server Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants