Anumantha Raja
Anumantha Raja

Reputation: 281

How to access the Azure user information?

Iam having trouble is accessing the user information of Azure accounts, for example i cannot access their email_id, name, pictures etc.. How can i access user information using Azure Resource Manager (ARM) REST API set? Briefly i will explain what i have done till now..

Step 1: I have registered my application in Azure Active Directory (AD) . Then i get my unique tenant id, client id and client key..

Step 2: By this i generated access token and i can access my VM's and Azure Resources by ARM REST API. But i could not able to find the API to get the user data like their name, pictures and email_id in ARM REST API set..

Upvotes: 2

Views: 1525

Answers (2)

Lily_user4045
Lily_user4045

Reputation: 793

If you can access VM through accesstoken. I guess your graph api uri has problem. Pls refer to the below format, it is Powershell command:

Invoke-RestMethod -Method get -Uri "https://graph.windows.net/<tenantid>/users/<userid>?api-version=1.6" -Headers $headers 

Upvotes: 1

Rahul Mohan
Rahul Mohan

Reputation: 533

you may use Azure Graph Api for accessing the AD user info. Use the access token, returned by the Azure AD against which the user is signed-in, for the authentication of REST API.

Use "Azure Graph Explorer" for understanding the graph api.

Upvotes: 1

Related Questions