Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

README.rst

azlogin

Azure Login OAuth 2.0 Device Flow Console Program.

Usage

Run and get bearer token for each subscription

$ .\azlogin
To sign in, use a web browser to open the page https://aka.ms/devicelogin and enter the code G9HFZ4NCY to authenticate.
....
[
   {
     "tenantId": "xxxxxxxx-xxxx-xxxxxxxxx-xxxxxxxxxxxx",
     "subscriptionId": "xxxxxxxx-xxxx-xxxxxxxxx-xxxxxxxxxxxx",
     "subscriptionName": "Developer Program Benefit",
     "bearer": "********************************************a"
   },
   {
     "tenantId": "xxxxxxxx-xxxx-xxxxxxxxx-xxxxxxxxxxxx",
     "subscriptionId": "xxxxxxxx-xxxx-xxxxxxxxx-xxxxxxxxxxxx",
     "subscriptionName": "foo",
     "bearer": "********************************************a"
   },
   {
     "tenantId": "xxxxxxxx-xxxx-xxxxxxxxx-xxxxxxxxxxxx",
     "subscriptionId": "xxxxxxxx-xxxx-xxxxxxxxx-xxxxxxxxxxxx",
     "subscriptionName": "kinmugi",
     "bearer": "********************************************a"
   }
]

Run and get bearer token for each subscription. Save the bearer token after logging in the variable and execute the API. For cutting bearer token, use jp (JMESPath).

$ cat filter.jp
[?subscriptionName == 'kinmugi'].bearer|[0]

$ $bearer = (.\azlogin | jp -u -e filter.jp)

$ curl "https://management.azure.com/subscriptions/xxxxxxxx-.../resourcegroups?api-version=2017-05-10" -H  "Authorization: Bearer $bearer"

See

About

Azure Login OAuth 2.0 Device Flow Console Program.

Topics

Resources

Releases

No releases published

Languages

You can’t perform that action at this time.