Utilize Azure Resource Management REST API’s

Solution for Utilize Azure Resource Management REST API’s
is Given Below:

I’m trying to utilize the [https://management.azure.com] REST API’s using my organization service account. I tried to hit the API using the TRY IT button on the following link [https://docs.microsoft.com/en-us/rest/api/resources/subscriptions/list]by directly logging in the browser itself and I’m able to fetch the expected details.

I need to implement the same for my .net application. When I try to hit the same API’s using my Application(Client) Id, Client secret key and tenant Id to get the token. And using that token I’m trying to get all the subscriptions details using the link mentioned above and I’m getting zero subscriptions as result. I’ve analyzed and got to know that the bearer token in the browser is different from my application which I’ve obtained. I copied the bearer token from the browser and tried to hit the API from my application and it’s giving me the expected results.

I’ve tried the same in POSTMAN and got no different result as my .net application.

I’ve referred the [https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal]to grant the access to my application

Referred the following link on how to obtain the token [https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth-ropc]and all I receive is access token, and using that token, It’s not returning me the list of subscriptions.

In addition to that, Under my apps => API permissions, I’ve added the Azure Service Management and granted the access.

Moreover, I’m not able to add the permission as Application. I tried add the same from Manifest, but it didn’t let since the permission name is same.

Please let me know if anyone has implemented or used these API’s and how ?Maybe share the permission which I’m missing. I’m stuck and need help !

Any suggestions and thoughts are welcome.

Please let me know if you need more info from my end.

Image Ref : App greyed out