How can I get profile picture from the azure AD

Narayan, Sachindra 46 Reputation points
2020-06-02T17:54:43.31+00:00

I am using Microsoft Graph API to get data and also using "https://graph.microsoft.com/beta/me/" API to get further data. But is there anyway I can fetch user's profile picture from any endpoint?

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} vote

Accepted answer
  1. Vasil Michev 119.7K Reputation points MVP Volunteer Moderator
    2020-06-02T18:10:03.377+00:00

    Yes, you can fetch it via the Graph API? https://learn.microsoft.com/en-us/graph/api/profilephoto-get?view=graph-rest-1.0

    Also via PowerShell and the Get-AzureADUserThumbnailPhoto cmdlet, or Get-UserPhoto if you are using Exchange Online.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. soumi-MSFT 11,831 Reputation points Microsoft Employee Moderator
    2020-06-03T16:52:03.313+00:00

    @Narayan, Sachindra , you can use the following Graph API to pull the profile picture for yourself or for any other user:

    For any User: GET /users/{id | userPrincipalName}/photo

    For the user account under whose context they have fetched the token: GET https://graph.microsoft.com/v1.0/me/photo/$value

    Please refer to the screenshot below:

    9064-graphapi-profilepic.jpg

    You might would like to take a look at the following Graph API documentation which might solve the purpose: https://learn.microsoft.com/en-us/graph/api/profilephoto-get?view=graph-rest-1.0

    Hope this helps.

    Do let us know if this helps and if there are any more queries around this, please do let us know so that we can help you further. Also, please do not forget to accept the response as Answer; if the above response helped in answering your query.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.