I need to make the code that will check the resources of their azure portal.
For example user a logins the this API will hit GET https://management.azure.com/subscriptions/{subscriptionId}/resources?api-version=2021-04-01
and the subscription ID will pass automatically of user a.
How do I authenticate the user?
How do I get their subscription ID in PHP code? So every user will be able to fetch their resources details on the website by simply login.
What should I do.
2
Answers
You can use the Azure REST API to list subscriptions. NOTE: a user may have more than one subscription under the current tenant and it will return all subscriptions that user has access to.
REST GET Subscriptions
GET https://management.azure.com/subscriptions?api-version=2020-01-01
https://learn.microsoft.com/en-us/rest/api/resources/subscriptions/list
Rest API reference
https://learn.microsoft.com/en-us/rest/api/azure/