Azure CLI Deployment Failure — Identity and Tenant Mismatch

Rafael Bolivar 1 Reputation point
2026-11-16T21:43:01.84+00:00

We are experiencing recurring Azure CLI authentication failures when deploying our Production Windows App Service, synergytroop-web.

Microsoft Azure's automated diagnostic identified an identity and tenant mismatch as the cause, rather than a problem with the App Service itself.

The diagnostic established that:

Our Production subscription, Synergy Troop - Production, belongs to Microsoft Entra tenant a3631059-e186-469f-990d-3afb6a5929d1.

The active Azure CLI authentication context does not match the subscription's tenant.

The Production App Service is healthy and has previously been deployed successfully.

Errors encountered:

During deployment through Azure Cloud Shell:

Timeout waiting for token from portal. Audience: https://appservice.azure.com

During interactive Azure CLI authentication using our business account, ******@synergytroop.com:

No subscriptions found for ******@synergytroop.com.

Our Azure subscription was originally established using a personal Microsoft account. We subsequently began using our Synergy Troop business account for Azure administration.

Although the Production subscription and App Service are accessible through the Azure Portal, Azure CLI authentication remains inconsistent.

Requested resolution:

We need Microsoft Support to identify and correct the account/tenant configuration responsible for these failures, ensure that our business account has appropriate Production subscription access, and restore reliable Azure CLI and Cloud Shell deployments.

We request a permanent solution, including verification of the correct Microsoft Entra tenant, account permissions, and Azure CLI authentication procedure.

Please preserve our existing Production subscription, applications, databases, billing arrangements, and administrator access. Do not transfer ownership or modify Production resources without our explicit authorization.

Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.

0 comments No comments

2 answers

Sort by: Oldest
  1. AI answer

    2026-11-16T21:43:55.06+00:00

    The permanent fix is to add the business identity to the subscription’s existing Microsoft Entra tenant, grant it an Azure RBAC role at the minimum required scope, and then authenticate Azure CLI explicitly against that tenant and subscription—without transferring the subscription or changing its directory association.

    1. Correct the business account’s access

    An administrator who already has permission to create role assignments on Synergy Troop - Production should perform these steps while signed in under the subscription’s current tenant:

    1. In Azure Portal, open Subscriptions.
    2. Select Synergy Troop - Production.
    3. Confirm Directory (tenant) ID is the expected production tenant.
    4. Open Access control (IAM) → Role assignments and search for the business account.
    5. If the account is absent from the tenant, first add or invite it into that Microsoft Entra directory.
    6. Return to Access control (IAM) → + Add → Add role assignment.
    7. Assign only the access required:
      • Contributor at the synergytroop-web resource group is normally sufficient when the account must deploy and manage resources there.
      • Scope the assignment to the App Service itself if the deployment process does not need access to related resources.
      • Use Owner or User Access Administrator only when the account must manage other users’ access.

    Users must exist in the subscription’s associated directory, and Azure resource access is separately controlled by Azure RBAC.^1^ Microsoft Entra administrative roles do not automatically provide access to Azure resources.^2^

    Portal access alone is therefore not conclusive: verify that the displayed principal is specifically the business identity in the production tenant and that it has an applicable Azure role assignment.

    2. Establish a clean, tenant-scoped CLI session

    After the role assignment is visible, clear the old CLI subscription cache and sign in explicitly to the production tenant:

    az account clear
    az config set core.login_experience_v2=off
    az login --tenant <production-tenant-id> --use-device-code
    
    az account list \
      --query "[].{Name:name,Subscription:id,Tenant:tenantId}" \
      --output table
    
    az account set --subscription "<production-subscription-id>"
    az account show --output table
    

    Tenant-specific login accepts the tenant object ID. In Azure CLI 2.61.0 or later, disabling the newer subscription selector can be necessary before using --tenant.^3^ Clearing the account cache forces Azure CLI to retrieve the current subscription list after permissions change.^4^

    The expected result is:

    • az account list includes Synergy Troop - Production.
    • Its Tenant value matches the production directory.
    • az account show reports that subscription as active.

    If login succeeds but the production subscription is still absent, this is no longer an App Service deployment problem: the business principal is missing from the correct tenant, lacks an effective subscription/resource role, or the role assignment has not refreshed.

    3. Recover the Cloud Shell App Service token

    Once the account and subscription checks pass, open a new Cloud Shell session and run:

    az login --tenant <production-tenant-id> --use-device-code
    az account set --subscription "<production-subscription-id>"
    az account show --output table
    

    Then retry the deployment. Microsoft’s Cloud Shell troubleshooting guidance specifically prescribes az login --use-device-code when Cloud Shell cannot acquire the required service token.^5^

    The https://appservice.azure.com/ token audience was added to public-cloud Cloud Shell in the February 2026 update.^6^ If the same audience timeout persists after tenant-scoped interactive login, record the UTC timestamp, correlation/request IDs, command, and full error for Support.

    4. Make production deployments durable

    For unattended or recurring production deployments, do not depend permanently on a human user’s cached CLI session. Microsoft requires MFA for Azure CLI user identities and recommends a managed identity, service principal, or federated identity for automation.^7^

    Prefer:

    • Workload identity federation/OpenID Connect for a supported CI/CD platform.
    • Otherwise, a dedicated service principal.
    • Grant that identity only the deployment role and resource scope it needs.

    This avoids future failures caused by interactive tokens while leaving the subscription, tenant association, billing, and resources unchanged.^8^

    5. Escalate the identity configuration safely

    If no authorized administrator can add the business identity, or the correct RBAC assignment still does not expose the subscription, create a support request from:

    Azure Portal → Help + support → Create a support request

    Select the production subscription and describe the issue as subscription/tenant access and Azure CLI authentication. Include:

    • Production subscription ID and expected tenant ID.
    • Business account’s tenant user/object ID, without passwords or tokens.
    • Output from az account list and az account show.
    • Exact Cloud Shell error, UTC timestamp, correlation ID, and activity ID.
    • Confirmation that the App Service is healthy.
    • Explicit instruction: Do not transfer the subscription, change its directory association, alter billing ownership, or modify production resources without written authorization.

    The support process allows logs or a browser trace to be attached and asks that the affected subscription be selected so the assigned engineer can access the correct scope.^9^ Do not initiate a tenant transfer as a troubleshooting step: transferring a subscription can permanently remove source-directory role assignments.^10^


    References

    1. Add users and assign access to your Azure subscription
    2. Azure roles, Microsoft Entra roles, and classic subscription administrator roles
    3. Sign into Azure interactively using the Azure CLI
    4. How to manage Azure subscriptions with the Azure CLI
    5. Azure Cloud Shell frequently asked questions (FAQ)
    6. Azure Cloud Shell release notes
    7. The impact of multifactor authentication on Azure CLI in automation scenarios
    8. Application identity and access management
    9. Create an Azure support request
    10. RBAC Issue with Directories - Microsoft Q&A
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

  2. Mariem Moalla 81 Reputation points MVP
    2026-11-16T22:44:38.03+00:00

    This error usually arises when the Azure CLI is authenticated to a tenant different from the subscription's tenant.

    To resolve this issue, verify the current login and subscription context by running: az account show az account list

    And ensure the active subscription corresponds to the tenant you intend to deploy resources in.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.