skip to Main Content

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?

2

Answers


  1. 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

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search