Ask Your Question
3

How can the error "AADSTS7000218: The request body should have 'client_assertion' or 'client_secret' parameter" in the Get-MsalToken be resolved?

asked 2022-09-18 11:00:00 +0000

david gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-05-22 19:00:00 +0000

bukephalos gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-09-18 11:00:00 +0000

Seen: 9 times

Last updated: May 22 '22