Microsoft 365 sign-in (Entra ID)

AADSTS7000222: the provided client secret keys are expired

AADSTS7000222 means the client secret an app uses to sign in to Microsoft Entra ID has expired. How to confirm the expiry, create a new secret and apply it.

By EpiFive Editorial TeamSources checked How we check our guides

What the error means

AADSTS7000222 is the Microsoft Entra code InvalidClientSecretExpiredKeysProvided. An application signs in to Microsoft Entra ID as itself, with its client ID and a client secret, and the secret it presented has expired. Microsoft's message tells you to create new keys for the app, or to consider certificate credentials for added security.

The error belongs to service principals, not users, so it appears in places such as automation logs, Azure Kubernetes Service (AKS) cluster operations and Azure CycleCloud. Microsoft's AKS articles show it inside BadRequest and InvalidClientSecret errors during cluster create or upgrade, and the CycleCloud article shows it when virtual machines are deployed or terminated.

Common causes

  • The client secret reached its expiry date and nobody rotated it.
  • An expired secret was supplied when a resource was created.
  • The secret stored in a service such as AKS expired before an update or upgrade.
  • A valid replacement secret exists in Microsoft Entra ID but has not been applied to the workload.

How to fix it

1. Confirm that the secret has expired

In the Azure portal, open Microsoft Entra ID, App registrations, select the affected application and check the secret information. From the command line, Microsoft's AKS article lists the credential metadata, including expiry dates, with:

az ad app credential list --id "$APP_ID"

Compare the expiry with the failure time in UTC. These checks show metadata only, not the secret value stored in the workload.

2. Create a new client secret

In App registrations, select the application, then Certificates & secrets, New client secret. Microsoft's CycleCloud article says the new secret value then appears in the list. Copy it and record its expiry date.

3. Apply the new secret to the workload

Update every place that authenticates with the old secret. For Azure CycleCloud, go to Configure, select the account in Cloud Provider Accounts, then Credentials, Edit, enter the value in Application Secret, select Validate and then Save. For AKS, follow Microsoft's Update or rotate the credentials for an AKS cluster article (reset the existing service principal credentials or create a new service principal), then retry the original operation once the credential update succeeds.

4. Remove the expired secret and plan the next rotation

As a general step, delete the expired secret once the workload works with the new one. Microsoft recommends recording each secret's expiry and setting a reminder to renew it, using the shortest practical expiry. The secret expiry report guide shows how to list secrets that are about to expire across the tenant.

5. Move to certificate credentials or a managed identity

Both the error message and Microsoft's CycleCloud article point to certificate credentials, and the article adds managed identities, as a way to avoid secret expiry altogether.

If nothing works

If the new secret is in place and you now see AADSTS7000215, the workload is sending a wrong value, such as the secret ID instead of the secret value. Also check that the service principal still exists in the tenant of the subscription, which the AKS article lists as another cause of the same alert.

What we checked

Four Microsoft Learn pages were read on 2026-11-21. The Microsoft Entra error code reference defines AADSTS7000222 as InvalidClientSecretExpiredKeysProvided. Two AKS troubleshooting articles show the full error text, the causes, the credential list command and the credential reset procedure. The Azure CycleCloud article shows the error, the New client secret steps and the prevention advice. The error was not reproduced for this page.

Last checked: 2026-11-21.

Official sources

Questions people ask

What does AADSTS7000222 mean?

Microsoft lists it as InvalidClientSecretExpiredKeysProvided: the client secret the app used to authenticate has passed its expiry date. Create a new secret and update the app, or switch to certificate credentials.

I already created a new secret. Why does AADSTS7000222 continue?

Microsoft's AKS article notes that a valid replacement might already exist in Microsoft Entra ID but has not been applied to the workload. The new value has to be put into the service or script that authenticates.

How do I stop AADSTS7000222 from happening again?

Microsoft recommends recording each secret's expiry date and renewing it before it lapses, using the shortest practical expiry and rotating on a schedule, or using certificate credentials or a managed identity instead of a client secret.

Guides that mention AADSTS7000222

Not your code?

Search the error code library, or report a code we don't cover. Spotted something out of date on this page? Report a correction.