I am tasked with granting admin-consent to an Enterprise application in a long list of tenants.
Currently I have automated this task with JMeter
with the following steps:
GET /{TenantId}/oauth2/authorize
POST /{TenantId}/login
(login with tenant admin account)POST /{TenantId}/Consent/Set
GET https://portal.azure.com/TokenAuthorize
And the process is working OK. However I would like to change it to MSAL
for two reasons: 1) JMeter is really not the best tool for this job, 2) I would also learn to use some of MSAL
, which I believe will come in handy in the future.
However I am not able to even get a token using MSAL
. Using the following readily available example: https://github.com/Azure-Samples/ms-identity-msal-java-samples/blob/main/2.%20Client-Side%20Scenarios/Username-Password-Flow/src/main/java/UsernamePasswordFlow.java, the following exception appears:
Exception in thread "main" java.util.concurrent.CompletionException: com.microsoft.aad.msal4j.MsalServiceException: AADSTS7000218: The request body must contain the following parameter: 'client_assertion' or 'client_secret'.
And I am not able to find the client_secret
or the client_assertion
for our Enterprise application.
Is there any other way to do it?
Thanks.