Retrieving all the users in an Azure subscription
Question
Friday, June 29, 2018 10:30 PM
Hi,
We have lot of references in the web to fetch the all Azure Active Directory users but i need to fetch all the users from an Azure subscription.
I have created an App in Azure active directory and added that App to the Subscription then used ClinetId and Client secret to create the AuthToken. Used the created auth token to hit the below REST API(an Azure resource management REST API)
https://management.azure.com/subscriptions/{my subscription id}/resourceGroups/{My resource group name}/providers/Microsoft.ApiManagement/service/{my Azure managment API Name}/users?api-version=2018-01-01
But this rest API is retrieving only one User, which is mine.
**Here i want to retrieve all the users in a subscription. **
Here is the MSDN url i used as reference.
Please can any one help me on this.
All replies (7)
Friday, July 6, 2018 5:15 PM âś…Answered
I found the answer from below stackoverflow Thread.
Saturday, June 30, 2018 7:16 AM
Make sure that you have enough permissions to read the users data from the Azure AD. For retrieving users list, you can refer this link. I would recommend you to have a look on Example-1 of this URL. This might help you.
Saturday, June 30, 2018 6:08 PM
Thanks for the reply Jitendra. Example URL you have given is using Graph API, If I don't understand wrong Graph API will fetch all the users from Azure active directory(not from Subscription). Correct me if i am wrong.
Here i want to retrieve all the users from an azure subscription.
I was looking for solution from few days, please can any one help me here.
Monday, July 2, 2018 7:35 AM
Hi,
Below URL is fetching the list of Users in a Subscription.
/en-us/azure/role-based-access-control/role-assignments-rest
But this URL is fetching only User GUID. But i want all the information of a User.
Please can any one help me in getting all the information of all the users.
Monday, July 2, 2018 8:46 AM
You can retrieve information regarding the user for each request utilizing policies. This is located in /Admin/Policies/ in the API publisher portal.
<policies>
<inbound>
<set-header name="request-email" exists-action="override">
<value>@(context.User.Email)</value>
</set-header>
<set-header name="request-id" exists-action="override">
<value>@(context.User.Id)</value>
</set-header>
</inbound>
<backend>
<forward-request />
</backend>
<outbound />
Also you can refer this MSDN thread.
Wednesday, July 4, 2018 9:38 AM
Just checking in to see if the above suggestions helped or you need further assistance on this specific issue.
Saturday, July 7, 2018 10:15 AM
Hey Aviansh Reddy,
Thanks for updating the forum with the solution that worked for you, which might help other community members.