Home › Entra ID › AADSTS7000218

Entra ID · AADSTS7000218 · Microsoft 365 / Entra ID

Entra ID AADSTS7000218 Error in Microsoft 365 - Missing client_assertion or client_secret

Root cause: Application configured as public client but requires confidential authentication; Fix: Enable Allow public client flows and set allowPublicClient to true.

Error Details

FactValueSourceNote
Exact error stringAADSTS7000218Azure AD sign-in logs-> Authentication failure
Application ID<app_id>Microsoft Entra admin center
Registry path for MSAL token cache on WindowsHKCU:\SOFTWARE\Microsoft\MSAL.PS\<app_id>\TokenCacheWindows registry-> Cache location
Relevant service/endpoint URLhttps://login.microsoftonline.com/<tenant>/oauth2/v2.0/tokenAzure AD endpoint
Log line signatureAADSTS7000218: The request body must contain the following parameter:MSAL log file-> Error pattern

Log Files to Check

What This Error Actually Means

The error code AADSTS7000218 is raised by Microsoft Entra ID (formerly Azure Active Directory) when an application attempts to authenticate using a public client flow but the application registration in Entra ID requires confidential client authentication. The component that raises this error is the OAuth 2.0 token endpoint, which enforces strict validation of request parameters based on the type of client making the request. Public clients are expected to use flows like authorization_code or device_code without including a client secret or assertion, whereas confidential clients must provide such credentials. This error signifies a mismatch between how an application is configured and how it attempts to authenticate with Entra ID. It indicates that either the application's registration in Entra ID has been updated to require a client secret but the application code still uses public client flows without providing one, or vice versa.

Affected Versions and Scope

This error affects Microsoft 365 tenants using Entra ID for authentication. It is particularly relevant when applications are being migrated from older configurations where they were allowed to use public client flows without secrets to newer configurations that enforce the use of confidential clients with secrets or certificates. The error does not affect scenarios where: - The application registration explicitly allows public client flows. - The application uses a confidential client flow and correctly includes a client secret in its authentication requests. - The application is configured as a public client but does not attempt to authenticate using flows that require a client secret (e.g., it only uses implicit grant type).

Where To Look First: Logs and Event IDs

To diagnose this issue, you should first check the following logs: The exact log line to grep for is: AADSTS7000218: The request body must contain the following parameter: Event IDs related to this issue include 4625 and 4723, which are logged in the Security event log on Windows systems when authentication attempts fail due to missing or incorrect parameters.

Root Causes

Application Registration Configuration Mismatch

This occurs when an application is registered as a public client but Entra ID requires it to use confidential client flows. This can happen if the 'Allow public client flows' toggle in Microsoft Entra admin center has been disabled for the app, or if the app manifest incorrectly specifies that public client flows are not allowed.

Incorrect MSAL Configuration

Applications using the MSAL library may be misconfigured to use PublicClientApplicationBuilder instead of ConfidentialClientApplicationBuilder. This can lead to authentication failures when confidential client credentials (client_secret) are required but not provided.

Expired or Missing Client Secret

If an application is configured as a confidential client, it must provide a valid and non-expired client secret in its token requests. If the secret has expired or was never set up correctly, this error will occur.

Fix Procedure

  1. Check Application Registration Settings:
    • Navigate to Microsoft Entra admin center > App registrations > > Authentication.
    • In Advanced settings, ensure that 'Allow public client flows' is set to Yes if the application should use public client flows without a secret. If it needs confidential client authentication, this setting must be No.
  2. Review App Manifest:
    • Navigate to Microsoft Entra admin center > App registrations > > Manifest.
    • Ensure that the 'allowPublicClient' property is set to true for public client applications. For confidential clients, this should be false or omitted.
  3. Create Client Secret (for Confidential Clients):
    • Navigate to Microsoft Entra admin center > App registrations > > Certificates & secrets.
    • Click 'New client secret' and create a new secret. Copy the value immediately as it will not be shown again.
    • Store this secret securely, such as in Azure Key Vault or an environment variable.
  4. Update Application Configuration:
    • Ensure that your application's configuration includes the client_secret parameter when making OAuth2 token requests for confidential clients. For public clients, ensure no secret is included and use appropriate grant types like authorization_code or device_code.
  5. Important: Changing application registration settings can affect existing users and devices. Ensure you communicate any changes to affected parties before making updates.
  6. Get-MgApplication -ApplicationId | Select-Object -ExpandProperty PasswordCredentials | Select-Object DisplayName,EndDateTime: Use this PowerShell cmdlet to check the expiry date of client secrets and ensure they are valid.

Error Code Variants

CodeDescription
AADSTS700016: The request body must contain the following parameter: 'grant_type'This error occurs when a required OAuth2 grant type is missing from the token request.
AADSTS700089: The client assertion or secret is invalidIndicates that a provided client_secret or client_assertion is either incorrect, expired, or not recognized by Entra ID.
AADSTS700114: The request body must contain the following parameter: 'client_id'This error occurs when the application's client identifier (client_id) is missing from the token request.

Verification

To verify that the fix has been applied correctly:

Prevention

To prevent recurrence of this issue, ensure that all application registrations in Entra ID are correctly configured to match the intended authentication flow (public vs confidential client). Implement a baseline policy requiring regular reviews and updates of application configurations. Additionally, use Azure Key Vault or similar secure storage solutions for managing client secrets, reducing the risk of exposure.
Tips: Use PowerShell cmdlets like Get-MgApplication to automate checks on application registrations and ensure compliance with security policies.
By following these steps and maintaining a proactive approach to application registration management in Entra ID, you can effectively mitigate the occurrence of AADSTS7000218 errors and improve overall system stability.

Sources & References

Related Guides

Get new error code fixes by email

Product-specific solutions for Intune, Autopilot, SCCM and Entra ID — straight to your inbox. No spam.