Forum Discussion

brettrandall's avatar
brettrandall
Copper Contributor
Nov 19, 2022

OAuth2 token from Instance Metadata Service (IMDS): Can I fetch using client_credentials POST?

I can call the IMDS and receive a token for my VM's System-assigned or User-assigned Managed Identities, per https://learn.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/how-to-use-vm-token#get-a-token-using-curl 

 

 

 

 

curl 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fmanagement.azure.com%2F' -H Metadata:true -s

 

 

 

 

But what if I want to fetch this token using an OAuth2 RFC6749 Client Credentials Request (4.4.2) by sending a POST with grant_type=client_credentials .  I have an application that wants to retrieve tokens in this way.

 

Is that possible?  I can only find GET requests to the IMDS for these oauth2/token endpoints documented.

No RepliesBe the first to reply

Share