Azure Easy way to generate bearer access token

 

Easy way to generate bearer access token

Issue:

·       How to generate bearer token?

·       What is the easiest way to generate it.


Solution:

 

A bearer access token is something which is used to perform authentication while calling azure resources.

For example, if you want to stop any azure app service or function through PowerShell or rest api or through code like C#, you should have bearer to perform authentication.

 

Generally, if you want to perform some management or admin operations then you need to pass user credentials again and again which is not recommended.

The easy way is to generate bearer token and pass to all request which is in a way equivalent to passing the credentials.

The only point is, Bearer token has some validity duration and it will expire after sometime however you can always regenerate it and use.

 

There used to be very tough mechanism to generate bearer access token earlier in Azure but now they have made it easy through PowerShell.

You just need to run one simple command to generate it.

 

az account get-access-token

 

 



 




















You can notice the expiration time also in the response.

 

Hope this helps.

 

 

No comments:

Post a Comment