Home > Software design >  Need to get client id of each user from azure portal and want to store in a variable using php
Need to get client id of each user from azure portal and want to store in a variable using php

Time:12-15

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.

CodePudding user response:

  1. Sign in to the Azure portal.
  2. Under the Azure services heading, select Subscriptions. (If no subscriptions are listed, you may need to switch Azure AD tenants.) Your Subscription IDs are listed in the second column.
  3. Copy the Subscription ID and paste it into a text document of your choice for use later.

CodePudding user response:

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://docs.microsoft.com/en-us/rest/api/resources/subscriptions/list

Rest API reference

https://docs.microsoft.com/en-us/rest/api/azure/

  • Related