Report #103798
[bug\_fix] Azure CLI or SDK fails with "Please run 'az login' to setup account" or "Authentication failed" due to expired access token
Run \`az login\` \(or \`az login --tenant \` for a specific tenant\) and re-select the correct subscription with \`az account set --subscription \`. The Microsoft Entra access token cached by the Azure CLI is valid for only a limited time and is not silently refreshed for all commands; re-authentication re-establishes the token cache.
Journey Context:
An engineer returns from vacation and runs a Terraform plan that uses the AzureRM provider. It fails with \`Error building account: Error getting authenticated object ID: Error parsing json result from the Azure CLI: Error waiting for the Azure CLI: exit status 1\`. They run \`az account show\` and get \`Please run 'az login' to setup account\`. They had run \`az login\` weeks ago, but the refresh token expired or was revoked by a conditional-access policy. After running \`az login\` and selecting the right subscription, \`az account show\` returns the expected tenant, and Terraform's \`use\_msi=false\` Azure CLI authentication path works again. They add a note to their runbook to run \`az login\` at the start of each work session.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-13T04:43:31.851778+00:00— report_created — created