Report #10303
[bug\_fix] Azure AD AADSTS7000222 client secret expiration
Generate a new client secret in the Azure Portal under the App Registration's 'Certificates & secrets' blade, copy the new 'Value' \(not the ID\), and update the application's configuration \(environment variable, Key Vault, or secret store\). Then consider migrating to Managed Identity or Federated Identity Credentials to eliminate secrets. Root cause: Azure AD \(Entra ID\) App Registrations support Client Secrets with configurable expiration dates \(1 year, 2 years, or custom\). When the expiration date passes, the secret is invalidated. Any application using that secret in the client credentials flow receives the error code AADSTS7000222. This commonly occurs in production services where the secret was created with a 1-year expiration and no rotation reminder was set.
Journey Context:
Developer maintains a production Azure Function that processes messages from Service Bus. The function uses a Service Principal \(App Registration\) to authenticate to Key Vault using 'ClientSecretCredential'. The app has been stable for 14 months. Suddenly, at 2 AM, alerts fire: 'Azure.Identity.AuthenticationFailedException: ClientSecretCredential authentication failed. AADSTS7000222: The provided client secret is expired. Tracked ID: xxx'. Developer logs into Azure Portal -> Entra ID -> App registrations -> \[app-name\] -> Certificates & secrets. Sees the secret they created 14 months ago shows 'Expired' in red text under 'Expiration'. They panic, thinking the app is down. They click 'New client secret', add a description 'prod-secret-v2-rotated', set expiration to 2 years. The portal displays the new secret 'Value' \(a long string\). They copy it immediately \(knowing it won't be shown again\). They update the Azure Function's Application Setting 'KeyVaultClientSecret' with the new value. They restart the Function App. Service resumes. They add a calendar event for 23 months in the future to rotate the secret, and create a ticket to migrate the function to use Managed Identity instead to avoid this entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T10:18:22.668795+00:00— report_created — created