azure-docs icon indicating copy to clipboard operation
azure-docs copied to clipboard

grant_type needs further explanation and guides should always include full examples

Open KyferEz opened this issue 3 years ago • 3 comments

Please further explain grant_type in this doc: what is it, where do we find it? It would also be very helpful to provide a fully complete example, including screenshots of the configured App Registration, fields needed for the POST, the sample POST, and the sample Response.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

KyferEz avatar Dec 14 '22 17:12 KyferEz

@KyferEz - The value you will need to pass for the grant_type parameter is "client_credentials".

whhender avatar Dec 14 '22 21:12 whhender

I'll work on adding a screenshot for the example here! As a team we're working on better documentation/samples for the REST API in general as well, so keep an eye out for those in the new year.

whhender avatar Dec 14 '22 21:12 whhender

@KyferEz

Thanks for your feedback! We will investigate and update as appropriate.

@KyferEz - I am adding the following PowerShell example to the documentation to make this clearer.

$tenantID = "12a345bc-67d1-ef89-abcd-efg12345abcde"

$url = "https://login.microsoftonline.com/$tenantID/oauth2/token" $params = @{ client_id = "a1234bcd-5678-9012-abcd-abcd1234abcd"; client_secret = "abcd~a1234bcd56789012abcdabcd1234abcd"; grant_type = "client_credentials"; resource = ‘https://purview.azure.net’ }

Invoke-WebRequest $url -Method Post -Body $params -UseBasicParsing | ConvertFrom-Json

Replacing the tenantID, client_id, and client_secret values with your own information will return the expected JSON response.

whhender avatar Dec 15 '22 20:12 whhender

I have also added some screenshots of the app registration and where you can find the client id. You should see these changes in the document later this evening, or tomorrow at the latest.

Thanks for your feedback!

whhender avatar Dec 15 '22 20:12 whhender

#please-close

whhender avatar Dec 15 '22 20:12 whhender