Skip to content

Azure MCP does not use your selected tenant #1706

@alexwolfmsft

Description

@alexwolfmsft

Describe the bug

Azure MCP Server seems to only work with a default tenant and doesn't pick up one that is set directly. For example, if you run az login --tenant , that tenant is not selected when you run prompts. Instead, you receive this message:

Your access token is from the wrong Azure tenant for subscription . Please re-authenticate using the authority https://login.windows.net/ and try again. If you recently transferred the subscription, it may take up to....

I received this error in Copilot Chat as well as programmatically. I tried various ways of signing in or switching tenants, but it always just picks the default.

Because tenant is set during az login, and does not have a separate command in the way subscriptions do (az account set <>) - does this mean you cannot use Azure MCP to access resources on other tenants?

Expected behavior

Azure MCP Server should use whatever tenant you signed in with using az login --tenant .

Actual behavior

Azure MCP Server always uses the default tenant (az login with no parameters equivalent, it seems).

Reproduction Steps

  1. Run az login --tenant
  2. Attempt to access resources in your targeted tenant ("List my resource groups")
  3. Provide your target subscription in your target tenant, if prompted
  4. Error is displayed

Environment

Copilot with VS Code, .NET or Node apps programmatically.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

In Progress

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions