Report #62562
[bug\_fix] AADSTS700082: The refresh token has expired due to inactivity
Run \`az login\` interactively to obtain a new refresh token, or switch to a service principal for non-interactive scenarios \(\`az login --service-principal -u -p --tenant \`\). User refresh tokens in Microsoft Entra ID have a max inactive lifetime \(configurable, default 90 days\). When using \`az login\` as a user in CI/CD or long-lived scripts, the cached refresh token in \`~/.azure/\` expires silently.
Journey Context:
An Azure DevOps pipeline \(or a cron job on a VM\) uses Azure CLI \(\`az\`\) to deploy resources. It has been running fine for months using an interactive user login cached on the agent \(\`az login\` was run once manually\). Suddenly, all jobs fail with 'AADSTS700082: The refresh token has expired due to inactivity'. The developer checks the service principal secret expiry, but it's a user identity. They examine \`~/.azure/\` and see \`refreshTokens.json\`. They realize user tokens expire after 90 days of inactivity by default. They run \`az login\` again to fix it temporarily, but realize interactive login is unsustainable for CI. They switch to creating a service principal and using \`az login --service-principal\`, which uses client secret and doesn't have refresh token expiry issues. The fix works because service principals use certificate or secret-based auth without the user token lifecycle.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T11:29:37.357581+00:00— report_created — created