Reputation: 752
I want to get the health and other resource details of a particular Azure Account or Subscription using these API's https://learn.microsoft.com/en-us/rest/api/resourcehealth/availabilitystatuses/listbysubscriptionid
When i do TryIt on the web page it works, but If i want to do it using say PostMan or programatically, how do i generate the Authorization key, I have seen docs to create Authorization Key using "App Registrations", but i dont have any WebApp here, All i want to do is get the details of a particular account or subscription using Azure provided API calls and using any AD user with proper roles for authentication. This link provides some details but then i dont have a clientid here, since i dont have any webapp https://msdn.microsoft.com/en-gb/library/azure/dn645543.aspx
Please let me know if anyone has tried doing this. Thanks
Upvotes: 1
Views: 3269
Reputation: 58723
You have to register an app in Azure AD. This does not need to be an actual "Web app". You are registering a service principal (you can think of it as a service account). After registering the app (with type Web App/API), generate a Key for it.
Write down the Application Id (Client Id) and the key (Client Secret). Then give the service principal access through the Access Control (IAM) section on the subscription/resource group/resource where you want to give the app access to.
You can then follow the instructions here to generate the access token: https://msdn.microsoft.com/en-gb/library/azure/dn645543.aspx.
Remember to use https://management.azure.com/
as the resource
since you are calling the ARM API.
Upvotes: 3