Daniel M
Daniel M

Reputation: 36

Azure Apim Bearer token

Hi guys im following the next tutorial from azure: https://learn.microsoft.com/en-us/rest/api/apimanagement/current-ga/subscription/create-or-update?tabs=HTTP&tryIt=true&source=docs [Azure create or update suscriptions]

I already made it work,but i dont know from where comes from the Bearer token that the example uses

Can anybody explain to me how i can get that bearer token? actually im planning to use this to create api keys from the back end but i dont exactly know from where i can request that bearer token.

I know it says "Azure Active Directory OAuth2 Flow" in the part of security but can anyone explain to me how that works?

Upvotes: 0

Views: 1237

Answers (2)

VenkateshDodda
VenkateshDodda

Reputation: 5546

Alternatively, you can generate the Bearer token/access token using cloud shell from the portal by following the below steps

  1. Sign-in to the Azure portal (https://portal.azure.com)
  2. Open cloud shell, select Power Shell
  3. If you have multiple subscription, using set-Azcontext cmdlet set a particular subscription as context to perform operation on that subscription.
  4. Run the cmdlet Get-AzAccessToken this will give you the access token.

Here is the sample output for reference:

enter image description here

Upvotes: 0

Venkatesan
Venkatesan

Reputation: 10455

you can get the bearer token by following commands in postman:

post https://login.microsoftonline.com/**{tenantid}**/oauth2/token

From your application you can get the tenant id and client id Azure portal ->Azure active directory ->your app->overview enter image description here

client secret: enter image description here

enter image description here

When you send the command you can get the bearer token.

enter image description here

Reference: Azure REST API: Create Bearer Token - cloudopszone.com

Upvotes: 1

Related Questions