Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The error "AADSTS7000218: The request body should have 'clientassertion' or 'clientsecret' parameter" occurs when the Microsoft Authentication Library (MSAL) client application is missing the required client secret or client assertion.

To resolve this error, follow these steps:

  1. Ensure that the client application has been registered in Azure Active Directory (AD).
  2. Generate a client secret or client assertion for the application.
  3. Pass the client secret or client assertion to the Get-MsalToken cmdlet as a parameter.
  4. Verify that the client ID, tenant ID, and scope parameters are correct.

Example command:

$clientId = "<your-client-id>"
$clientSecret = "<your-client-secret>"

Connect-MsalService -ClientId $clientId -ClientSecret $clientSecret

$token = Get-MsalToken -TenantId "<your-tenant-id>" -Scope "https://graph.microsoft.com/.default"

Note: Replace the placeholders in the command with your actual values.