I have Azure App Registration with active secret.

I'm trying to obtain token using v1.0 like below (clientId is an ID of the above App Registration)
$body = @{
grant_type = 'client_credentials';
client_id = $clientId;
client_secret = $clientSecret;
resource = $resourceId;
}
$aadResponse = Invoke-WebRequest -Uri "https://login.microsoftonline.com/$aadtenantId/oauth2/token" -Method POST -Body $body -UseBasicParsing
After regenerating credential using az ad app credential reset --id XXX everything works as expected - token is properly obtained.
However, in Azure Devops I got the following error while getting values from KV

Then I'm going to Azure Devops Service Connection and with edit, verify and save I'm able to connect with KV without any further changes.

However, this action breaks initially working get of token (as described above).
I'm 100% sure:
- Password is correct
- I'm really using a password, not its id
- Encoding password doesn't help
- There is no other action except
verifyservice connection - I'm using Failed to obtain the JWT by using the service principal client ID as a reference to Service Connections
What am I doing wrong?






