Share via


Query request for Azure Usage/Billing API using Postman

https://msdn.microsoft.com/library/en-us/Mt218998.aspx

 

Generate Bearer Token

Login-AzureRmAccount
$AccountName ="azureauto@AADTenants.onmicrosoft.com"
$Password = "UserPassword"

$PayLoad="resource=https://management.core.windows.net/&client_id=xxxxxxxxxxxxxxxxxxxxx&grant_type=password&username="+$AccountName+"&scope=openid&password="+$Password
$Response=Invoke-WebRequest -Uri "https://login.microsoftonline.com/Common/oauth2/token" -Method POST -Body $PayLoad

$ResponseJSON=$Response|ConvertFrom-Json
$ResponseJSON

Results,

 

From Postman