Skip to main content
AppAlert

AADSTS7005003: client secret revoked

Reviewed

On this page
Error message returned by Microsoft Entra
AADSTS7005003: The provided client secret keys for app '<application-id>' are revoked. Please specify a valid client secret.

What the message means

The app asked Microsoft Entra ID (formerly Azure AD) for a token with a client secret that someone revoked. Microsoft's revoked credentials troubleshooting article lists the code as InvalidClientSecretRevokedKeysProvided. In the message, the app is named by its application (client) ID.

A revoked secret cannot get new tokens, even before its expiry date. Tokens issued before the revocation do not all stop at once: some Microsoft resources invalidate them early, and others accept them until they expire, which can take up to 24 hours.

Microsoft's error reference notes that error codes and messages can change. Match the message text as well as the code.

Which case is yours

Someone in your organization revoked the secret. Administrators and application owners with sufficient permissions can revoke a credential. Ask them before you replace anything, because the reason for the revocation decides whether the app may get a new secret straight away.

Microsoft revoked the secret. Microsoft can revoke a credential after detecting that a threat actor compromised it, for example by stealing an existing credential or adding one to the app. Microsoft says to treat its revocation as a sign of compromise. Involve your security team first. Step 3 under Fix it shows how to tell the two cases apart.

The error names another revoked credential type. Microsoft's article lists related codes for other credentials. Read the code before you follow this page:

  • AADSTS7005004 (InvalidClientAssertionRevokedKeysProvided): the client assertion uses a key that was revoked. AADSTS700027 returns the same message for a revoked key; see AADSTS700027.
  • AADSTS7005005 (FederatedIdentityCredentialRevoked): a federated identity credential was revoked. The message includes the credential's ID.
  • AADSTS7005006 (TokenRevocationBlocksIssuance): the app has blocked token issuance for the request.

All of them lead to the same investigation and recovery, described in Revoked credential.

The secret expired instead. An expired secret returns AADSTS7000222, and a value that matches no current secret returns AADSTS7000215.

Fix it

  1. Read the application ID from the message. Microsoft's article records revocations in a tokenRevocations collection on the application object and on the service principal. Query both with the Microsoft Graph beta endpoint, using the application ID rather than an object ID:

    GET https://graph.microsoft.com/beta/applications(appId='<application-id>')/tokenRevocations
    GET https://graph.microsoft.com/beta/servicePrincipals(appId='<application-id>')/tokenRevocations
    

    An empty result from one object does not rule out an entry on the other. An authorization error does not mean there are no revocations.

  2. Find the entry for the failing secret. Each entry names the affected credential in credential.id. Compare it with the key IDs of the app's secrets, listed by Azure CLI:

    az ad app credential list --id '<application-id>' --output table
    
  3. Check who issued the revocation. Microsoft revoked it if the entry's auditDetails.issuedBy equals 0e0fb671-b107-448b-a273-9d0ded7627a7, or if the Update application or Update service principal audit event was initiated by Azure Active Directory Protection Services. Missing audit history alone proves nothing; check the date range against audit log retention for your license.

  4. Once your security team agrees, add a replacement secret. With Azure CLI, pass --append to az ad app credential reset so the command does not remove the existing secrets. Copy the value immediately; Entra shows it only once.

  5. Update every workload that used the revoked secret and test a fresh token request from each one. Confirm the new key ID in the sign-in logs with Identify the active credential.

  6. Leave the revoked secret revoked. Microsoft's recovery steps also say to remove any credentials or access a threat actor added and to look for other unauthorized changes to the app and its enterprise application.

Where the old credential still lives

The revoked value is still stored in every system that signed in with it. Replace it in each copy, and treat each copy as a place it may have leaked from:

  • Key Vault secrets and the apps that read them at startup.
  • App settings and environment variables in App Service, Functions, and container platforms.
  • Azure DevOps service connections and variable groups, and secrets in other CI systems.
  • Configuration files and scheduled tasks on servers and integration hosts.
  • Third-party products that store the client ID and secret in their own settings.

Prevent the next one

A revocation comes without warning, so the only preparation is a tested procedure for adding a credential and updating every consumer. The same steps serve a planned renewal, so practise them there. The client secret renewal guide gives a safe order.

Keep fewer copies of each secret and record which workload holds which key ID. Microsoft recommends certificates or federated credentials instead of client secrets for production.

FAQ

Does AADSTS7005003 mean the client secret expired?

No. Revocation is separate from expiry: a revoked secret cannot get new tokens even before its expiry date. An expired secret returns AADSTS7000222 instead. Renewing early or creating a secret with a later date does not lift a revocation.

Can I remove the revocation to make the error go away?

Only if your investigation shows the revocation was wrong and the secret is safe. Deleting a revocation lets the secret work again, but it does not rotate the secret or remove a copy held by a threat actor. Microsoft documents the steps to remove a revocation in its revoked credentials article.

Why do some calls still work after the revocation?

Tokens the app obtained before the revocation can stay valid until they expire, which can take up to 24 hours. Some Microsoft resources invalidate them sooner. Each workload fails when it next needs a new token.

What is the difference between AADSTS7005003 and AADSTS7005004?

AADSTS7005003 is a revoked client secret. AADSTS7005004 is a client assertion that uses a revoked key. Both mean revoked, not expired, and both follow the same recovery.