{
  "schemaVersion": "1.0",
  "code": "7000215",
  "name": "Invalid client secret",
  "title": "AADSTS7000215: Invalid client secret is provided",
  "url": "https://brambrinkmeier.com/entra/aadsts/7000215/",
  "alternates": {
    "markdown": "https://brambrinkmeier.com/entra/aadsts/7000215.md",
    "json": "https://brambrinkmeier.com/api/aadsts/7000215.json",
    "html": "https://brambrinkmeier.com/entra/aadsts/7000215/"
  },
  "description": "AADSTS7000215: an app sent an invalid client secret. Usually a rotation mistake; repeated failures from foreign IPs suggest a leaked secret. KQL.",
  "summary": "AADSTS7000215 means an app or service principal sent a client secret that Microsoft Entra ID didn't accept. Usually it is a developer or rotation mistake. The security signal is repeated failures for one app ID from an IP you don't own, which suggests someone trying a leaked or old secret. Hunt it in AADServicePrincipalSignInLogs.",
  "inMicrosoftReference": true,
  "unlistedChecked": null,
  "meaningText": "Microsoft's description:\n\n> Invalid client secret is provided. Developer error - the app is attempting to sign in without the necessary or correct authentication parameters.\n\nThe reference table gives this code no PascalCase name. Two siblings help you tell the cases apart:\n\n- **[7000222](https://brambrinkmeier.com/entra/aadsts/7000222/) InvalidClientSecretExpiredKeysProvided**: *\"The provided client secret keys are expired. Create new keys for your app, or consider using certificate credentials for added security\"*\n- **7000218**: *\"The request body must contain the following parameter: 'client_assertion' or 'client_secret'.\"*\n\nSo 7000222 means the secret was right but expired, 7000218 means no secret or assertion was sent at all, and 7000215 means a secret was sent and it was wrong.",
  "sections": [
    {
      "heading": "What does AADSTS7000215 mean?",
      "text": "Microsoft's description:\n\n> Invalid client secret is provided. Developer error - the app is attempting to sign in without the necessary or correct authentication parameters.\n\nThe reference table gives this code no PascalCase name. Two siblings help you tell the cases apart:\n\n- **[7000222](https://brambrinkmeier.com/entra/aadsts/7000222/) InvalidClientSecretExpiredKeysProvided**: *\"The provided client secret keys are expired. Create new keys for your app, or consider using certificate credentials for added security\"*\n- **7000218**: *\"The request body must contain the following parameter: 'client_assertion' or 'client_secret'.\"*\n\nSo 7000222 means the secret was right but expired, 7000218 means no secret or assertion was sent at all, and 7000215 means a secret was sent and it was wrong."
    },
    {
      "heading": "Reproduced in the lab",
      "text": "On 30 October 2026 an automated lab run created an app registration with a client secret, then sent a client-credentials request with a made-up secret. Entra returned `AADSTS7000215`:\n\n> AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID, for a secret added to app '<app id>'.\n\nA control request in the same run, with the real secret, returned a token. So this code means the secret itself is wrong, not that the app or the tenant is misconfigured.\n\nThe sign-in log row isn't captured yet; see [how pages are checked](https://brambrinkmeier.com/methodology/)."
    },
    {
      "heading": "Is it an attack?",
      "text": "Usually not. Microsoft labels it a developer error, and most 7000215 comes from a typo in configuration or a system that still holds a secret you rotated. The security reading depends on where the requests come from.\n\n| Pattern | Likely meaning |\n|---|---|\n| 7000215 for one app from your own servers or build agents, starting right after a secret rotation | A system still holding the old secret. Benign, but it tells you exactly which systems to update. |\n| 7000215 for one app from an IP you don't own and have never seen succeed for that app | Someone trying a secret for your app from outside. A leaked or old secret is the likely source. Investigate. |\n| 7000215 followed by a success (`ResultType` `\"0\"`) for the same app from the same unknown IP | The attacker found a working secret. Treat the app as compromised. |\n| 7000215 spread across many app IDs from one IP | Someone testing a set of credentials against your tenant. Investigate the source. |"
    },
    {
      "heading": "How do I find it in my logs (KQL)?",
      "text": "Failures by app and source IP:\n\n```kusto\nAADServicePrincipalSignInLogs\n| where TimeGenerated > ago(7d)\n| where ResultType == \"7000215\"\n| summarize Attempts = count(),\n            FirstSeen = min(TimeGenerated),\n            LastSeen = max(TimeGenerated),\n            KeyIds = make_set(ServicePrincipalCredentialKeyId, 10)\n          by AppId, ServicePrincipalName, IPAddress\n| sort by Attempts desc\n```\n\nFailures from IPs that never had a success for the same app in the last 30 days:\n\n```kusto\nlet knownAppIPs =\n    AADServicePrincipalSignInLogs\n    | where TimeGenerated > ago(30d)\n    | where ResultType == \"0\"\n    | distinct AppId, IPAddress;\nAADServicePrincipalSignInLogs\n| where TimeGenerated > ago(1d)\n| where ResultType == \"7000215\"\n| join kind=leftanti knownAppIPs on AppId, IPAddress\n| summarize Attempts = count(), LastSeen = max(TimeGenerated) by AppId, ServicePrincipalName, IPAddress\n| sort by Attempts desc\n```\n\nAny IP from that list that later succeeds for the same app:\n\n```kusto\nlet failedFrom =\n    AADServicePrincipalSignInLogs\n    | where TimeGenerated > ago(7d)\n    | where ResultType == \"7000215\"\n    | summarize FirstFail = min(TimeGenerated) by AppId, IPAddress;\nAADServicePrincipalSignInLogs\n| where TimeGenerated > ago(7d)\n| where ResultType == \"0\"\n| join kind=inner failedFrom on AppId, IPAddress\n| where TimeGenerated > FirstFail\n| project TimeGenerated, AppId, ServicePrincipalName, IPAddress, ServicePrincipalCredentialKeyId, FirstFail\n| sort by TimeGenerated asc\n```\n\nCheck two things in your own workspace before relying on these queries:\n\n- The Azure Monitor reference for `AADServicePrincipalSignInLogs` describes `ResultType` as *\"Success or Failure\"*, while the user sign-in tables document it as the numeric error code as a string. Look at a few failed rows and confirm they carry `\"7000215\"` and that successes carry `\"0\"`. If they don't, filter on `ResultSignature` (*\"Contains the error code, if any, for the sign-in operation\"*) instead.\n- Whether `ServicePrincipalCredentialKeyId` is filled in on a **failed** secret isn't documented. A wrong secret may not match any key, so the column may be empty. On successes it tells you which credential was used."
    },
    {
      "heading": "How does Conditional Access affect it?",
      "text": "- A service principal using a client secret has no MFA step.\n- 7000215 is a failed credential check. For user sign-ins, Conditional Access only evaluates after the first factor succeeds; the same logic suggests no policy was evaluated here. That is reasoning from the user case, not a documented statement for service principals.\n- So the controls that matter are on the credential itself: who can read it, where it is stored, and whether it is a secret at all."
    },
    {
      "heading": "How do I fix AADSTS7000215?",
      "text": "**For developers:** check that the app sends the current secret for the right app registration and tenant. If the secret expired, you get [7000222](https://brambrinkmeier.com/entra/aadsts/7000222/), not 7000215.\n\n**For admins:**\n1. After a rotation, use the first query to list every IP still failing for that app, and update those systems.\n2. If failures come from an IP you don't own, treat the app's existing secrets as exposed: create a new credential, remove the old ones from the app registration, and update your own systems.\n3. If the third query returns a row, the app was used by someone else. Review what the app's permissions allow and what it accessed after that time.\n4. Follow Microsoft's own hint in the 7000222 message and *\"consider using certificate credentials for added security\"*."
    }
  ],
  "microsoftWording": {
    "text": "Invalid client secret is provided. Developer error - the app is attempting to sign in without the necessary or correct authentication parameters.",
    "source": "Microsoft's error code reference, as quoted on the page",
    "sourceUrl": "https://learn.microsoft.com/en-us/entra/identity-platform/reference-error-codes"
  },
  "securityReading": {
    "category": {
      "id": "app-config",
      "label": "App configuration"
    },
    "kind": {
      "id": "failure",
      "label": "Failure"
    },
    "attackSignal": {
      "level": "medium",
      "label": "Medium: worth a look in context"
    },
    "mitre": [
      {
        "id": "T1078.004",
        "name": "Valid Accounts: Cloud Accounts",
        "url": "https://attack.mitre.org/techniques/T1078/004/"
      }
    ],
    "tables": [
      "AADServicePrincipalSignInLogs"
    ],
    "isItAnAttack": "Usually not. Microsoft labels it a developer error, and most 7000215 comes from a typo in configuration or a system that still holds a secret you rotated. The security reading depends on where the requests come from.\n\n| Pattern | Likely meaning |\n|---|---|\n| 7000215 for one app from your own servers or build agents, starting right after a secret rotation | A system still holding the old secret. Benign, but it tells you exactly which systems to update. |\n| 7000215 for one app from an IP you don't own and have never seen succeed for that app | Someone trying a secret for your app from outside. A leaked or old secret is the likely source. Investigate. |\n| 7000215 followed by a success (`ResultType` `\"0\"`) for the same app from the same unknown IP | The attacker found a working secret. Treat the app as compromised. |\n| 7000215 spread across many app IDs from one IP | Someone testing a set of credentials against your tenant. Investigate the source. |",
    "conditionalAccess": {
      "heading": "How does Conditional Access affect it?",
      "text": "- A service principal using a client secret has no MFA step.\n- 7000215 is a failed credential check. For user sign-ins, Conditional Access only evaluates after the first factor succeeds; the same logic suggests no policy was evaluated here. That is reasoning from the user case, not a documented statement for service principals.\n- So the controls that matter are on the credential itself: who can read it, where it is stored, and whether it is a secret at all."
    }
  },
  "kql": [
    {
      "title": null,
      "leadIn": "Failures by app and source IP:",
      "query": "AADServicePrincipalSignInLogs\n| where TimeGenerated > ago(7d)\n| where ResultType == \"7000215\"\n| summarize Attempts = count(),\n            FirstSeen = min(TimeGenerated),\n            LastSeen = max(TimeGenerated),\n            KeyIds = make_set(ServicePrincipalCredentialKeyId, 10)\n          by AppId, ServicePrincipalName, IPAddress\n| sort by Attempts desc"
    },
    {
      "title": null,
      "leadIn": "Failures from IPs that never had a success for the same app in the last 30 days:",
      "query": "let knownAppIPs =\n    AADServicePrincipalSignInLogs\n    | where TimeGenerated > ago(30d)\n    | where ResultType == \"0\"\n    | distinct AppId, IPAddress;\nAADServicePrincipalSignInLogs\n| where TimeGenerated > ago(1d)\n| where ResultType == \"7000215\"\n| join kind=leftanti knownAppIPs on AppId, IPAddress\n| summarize Attempts = count(), LastSeen = max(TimeGenerated) by AppId, ServicePrincipalName, IPAddress\n| sort by Attempts desc"
    },
    {
      "title": null,
      "leadIn": "Any IP from that list that later succeeds for the same app:",
      "query": "let failedFrom =\n    AADServicePrincipalSignInLogs\n    | where TimeGenerated > ago(7d)\n    | where ResultType == \"7000215\"\n    | summarize FirstFail = min(TimeGenerated) by AppId, IPAddress;\nAADServicePrincipalSignInLogs\n| where TimeGenerated > ago(7d)\n| where ResultType == \"0\"\n| join kind=inner failedFrom on AppId, IPAddress\n| where TimeGenerated > FirstFail\n| project TimeGenerated, AppId, ServicePrincipalName, IPAddress, ServicePrincipalCredentialKeyId, FirstFail\n| sort by TimeGenerated asc"
    }
  ],
  "kqlSectionText": "Failures by app and source IP:\n\n```kusto\nAADServicePrincipalSignInLogs\n| where TimeGenerated > ago(7d)\n| where ResultType == \"7000215\"\n| summarize Attempts = count(),\n            FirstSeen = min(TimeGenerated),\n            LastSeen = max(TimeGenerated),\n            KeyIds = make_set(ServicePrincipalCredentialKeyId, 10)\n          by AppId, ServicePrincipalName, IPAddress\n| sort by Attempts desc\n```\n\nFailures from IPs that never had a success for the same app in the last 30 days:\n\n```kusto\nlet knownAppIPs =\n    AADServicePrincipalSignInLogs\n    | where TimeGenerated > ago(30d)\n    | where ResultType == \"0\"\n    | distinct AppId, IPAddress;\nAADServicePrincipalSignInLogs\n| where TimeGenerated > ago(1d)\n| where ResultType == \"7000215\"\n| join kind=leftanti knownAppIPs on AppId, IPAddress\n| summarize Attempts = count(), LastSeen = max(TimeGenerated) by AppId, ServicePrincipalName, IPAddress\n| sort by Attempts desc\n```\n\nAny IP from that list that later succeeds for the same app:\n\n```kusto\nlet failedFrom =\n    AADServicePrincipalSignInLogs\n    | where TimeGenerated > ago(7d)\n    | where ResultType == \"7000215\"\n    | summarize FirstFail = min(TimeGenerated) by AppId, IPAddress;\nAADServicePrincipalSignInLogs\n| where TimeGenerated > ago(7d)\n| where ResultType == \"0\"\n| join kind=inner failedFrom on AppId, IPAddress\n| where TimeGenerated > FirstFail\n| project TimeGenerated, AppId, ServicePrincipalName, IPAddress, ServicePrincipalCredentialKeyId, FirstFail\n| sort by TimeGenerated asc\n```\n\nCheck two things in your own workspace before relying on these queries:\n\n- The Azure Monitor reference for `AADServicePrincipalSignInLogs` describes `ResultType` as *\"Success or Failure\"*, while the user sign-in tables document it as the numeric error code as a string. Look at a few failed rows and confirm they carry `\"7000215\"` and that successes carry `\"0\"`. If they don't, filter on `ResultSignature` (*\"Contains the error code, if any, for the sign-in operation\"*) instead.\n- Whether `ServicePrincipalCredentialKeyId` is filled in on a **failed** secret isn't documented. A wrong secret may not match any key, so the column may be empty. On successes it tells you which credential was used.",
  "fix": {
    "short": "Developer: send the current secret for the right app registration and tenant. Admin: after a rotation, find every IP still failing for the app and update those systems. If failures come from an IP you don't own, create a new credential and remove the old secrets from the app registration.",
    "steps": "**For developers:** check that the app sends the current secret for the right app registration and tenant. If the secret expired, you get [7000222](https://brambrinkmeier.com/entra/aadsts/7000222/), not 7000215.\n\n**For admins:**\n1. After a rotation, use the first query to list every IP still failing for that app, and update those systems.\n2. If failures come from an IP you don't own, treat the app's existing secrets as exposed: create a new credential, remove the old ones from the app registration, and update your own systems.\n3. If the third query returns a row, the app was used by someone else. Review what the app's permissions allow and what it accessed after that time.\n4. Follow Microsoft's own hint in the 7000222 message and *\"consider using certificate credentials for added security\"*."
  },
  "labReproduced": {
    "date": "2026-10-30",
    "method": "Client-credentials token request against a lab tenant",
    "scenario": "Wrong client secret",
    "message": "AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID, for a secret added to app '<app id>'.",
    "logCaptured": null,
    "kqlTested": null
  },
  "labSectionText": "On 30 October 2026 an automated lab run created an app registration with a client secret, then sent a client-credentials request with a made-up secret. Entra returned `AADSTS7000215`:\n\n> AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID, for a secret added to app '<app id>'.\n\nA control request in the same run, with the real secret, returned a token. So this code means the secret itself is wrong, not that the app or the tenant is misconfigured.\n\nThe sign-in log row isn't captured yet; see [how pages are checked](https://brambrinkmeier.com/methodology/).",
  "labRuns": [
    {
      "date": "2026-10-30",
      "run": "round 5",
      "method": "token-endpoint requests against a lab tenant, using lab-created test apps",
      "issue": "https://github.com/GrantZero604/Brambrinkmeier.com/issues/69",
      "scenario": "Wrong client secret",
      "expected": "7000215",
      "got": "7000215",
      "matchedExpectation": true,
      "message": "AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID, for a secret ad"
    },
    {
      "date": "2026-10-30",
      "run": "round 6",
      "method": "token-endpoint requests against a lab tenant, using lab-created test apps",
      "issue": "https://github.com/GrantZero604/Brambrinkmeier.com/issues/70",
      "scenario": "Wrong client secret",
      "expected": "7000215",
      "got": "7000215",
      "matchedExpectation": true,
      "message": "AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID, for a secret ad"
    },
    {
      "date": "2026-10-30",
      "run": "round 7",
      "method": "token-endpoint requests against a lab tenant",
      "issue": "https://github.com/GrantZero604/Brambrinkmeier.com/issues/71",
      "scenario": "Wrong client secret",
      "expected": "7000215",
      "got": "7000215",
      "matchedExpectation": true,
      "message": "AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID, for a secret ad"
    },
    {
      "date": "2026-10-31",
      "run": "round 8",
      "method": "token-endpoint and device-code requests against a lab tenant",
      "issue": "https://github.com/GrantZero604/Brambrinkmeier.com/issues/72",
      "scenario": "Device code redeemed with a different client ID",
      "expected": "70016 / 7000215 / 70002",
      "got": "90023",
      "matchedExpectation": false,
      "message": "AADSTS90023: ClientId passed in the request doesn't match the one in cache"
    },
    {
      "date": "2026-10-31",
      "run": "round 8",
      "method": "token-endpoint and device-code requests against a lab tenant",
      "issue": "https://github.com/GrantZero604/Brambrinkmeier.com/issues/72",
      "scenario": "Wrong client secret",
      "expected": "7000215",
      "got": "7000215",
      "matchedExpectation": true,
      "message": "AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID, for a secret ad"
    },
    {
      "date": "2026-10-31",
      "run": "round 9",
      "method": "token-endpoint and device-code requests against a lab tenant",
      "issue": "https://github.com/GrantZero604/Brambrinkmeier.com/issues/73",
      "scenario": "Device code redeemed with a different client ID",
      "expected": "70016 / 7000215 / 70002",
      "got": "90023",
      "matchedExpectation": false,
      "message": "AADSTS90023: ClientId passed in the request doesn't match the one in cache"
    },
    {
      "date": "2026-10-31",
      "run": "round 9",
      "method": "token-endpoint and device-code requests against a lab tenant",
      "issue": "https://github.com/GrantZero604/Brambrinkmeier.com/issues/73",
      "scenario": "Wrong client secret",
      "expected": "7000215",
      "got": "7000215",
      "matchedExpectation": true,
      "message": "AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID, for a secret ad"
    }
  ],
  "verification": "lab-reproduced",
  "related": [
    "7000222",
    "700016",
    "500011",
    "65001",
    "70002",
    "700024",
    "900144",
    "5002730",
    "7000110",
    "7000112",
    "7000216",
    "7000218",
    "9002313",
    "9002326"
  ],
  "coveredBy": [
    {
      "title": "After a web-server breach like PHP2Shell: patch, then hunt credential reuse in Entra ID",
      "url": "https://brambrinkmeier.com/guides/hunt-credential-reuse-after-web-server-breach/"
    },
    {
      "title": "Azure CLI: \"Resource was disallowed by policy. Reasons: MFA is required\"",
      "url": "https://brambrinkmeier.com/guides/azure-cli-mfa-required-resource-disallowed-by-policy/"
    }
  ],
  "sources": [
    {
      "title": "Microsoft Entra authentication and authorization error codes",
      "url": "https://learn.microsoft.com/en-us/entra/identity-platform/reference-error-codes"
    },
    {
      "title": "AADServicePrincipalSignInLogs table reference (Azure Monitor)",
      "url": "https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/aadserviceprincipalsigninlogs"
    }
  ],
  "published": null,
  "lastUpdated": "2026-10-30",
  "lastVerified": null,
  "license": "CC BY 4.0",
  "licenseUrl": "https://creativecommons.org/licenses/by/4.0/",
  "licenseNote": "CC BY 4.0 covers the author's own text and classification fields. Quoted Microsoft error wording belongs to Microsoft, is quoted with its source and can change.",
  "attribution": "Bram Brinkmeier, \"AADSTS7000215: Invalid client secret is provided\", https://brambrinkmeier.com/entra/aadsts/7000215/ (CC BY 4.0)",
  "microsoftErrorLookup": "https://login.microsoftonline.com/error?code=7000215"
}
