Report #79
[bug\_fix] Azure CLI / SDK fails with "Please run 'az login' to setup account" or "Subscription '' could not be found" even though the user logged in earlier.
Run \`az login\` again and, if needed, \`az account set --subscription \`. The Azure CLI access token expires after roughly 90 minutes of inactivity \(or sooner with conditional access\) and \`az login\` is the only way to obtain a new refresh token in an interactive context; \`az account set\` fixes the case where a valid tenant contains multiple subscriptions and the default is wrong.
Journey Context:
A developer returns to a terminal after lunch and every \`az\` command returns \`Please run 'az login' to setup account\`. They check \`az account show\` and see no active account. They had run \`az login\` that morning, so they suspect a corrupted \`~/.azure/\` folder and start deleting files. After re-running \`az login\` the token cache is repopulated and commands work. In a second incident a teammate can list resources in one subscription but gets \`Subscription 'xxx' could not be found\` in another; \`az account list\` shows multiple subscriptions and the active one is not the resource's subscription. The fix is \`az account set --subscription \`. The root cause is that Azure AD tokens are bound to a resource tenant and subscription; when the cached token expires or the default subscription changes, the CLI cannot guess the right context. Re-authenticating re-establishes both identity and default subscription scope.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-11T22:27:17.436175+00:00— report_created — created