Home > Net >  Azure: Failed to retrieve user's profile photo and upload to the Azure Blob storage
Azure: Failed to retrieve user's profile photo and upload to the Azure Blob storage

Time:05-31

I am trying to fetch profile photos of users through Microsoft Graph by running the below query:

https://graph.microsoft.com/beta/users/USER_Name/photo

After retrieving the photos of the required users, I have copied photos on the disk. I want to upload it to Azure blob programmatically

I have created a storage account. I have registered an application in Azure AD for connecting to Microsoft Graph. I have granted the required permissions.

But I am stuck on fetching the profile photo itself.

Could anyone help me on achieving the above scenarios?

CodePudding user response:

To retrieve the profile photo of a user via Ms Graph please try the below query:

https://graph.microsoft.com/beta/users/UPN/photo/$value

I have tried to reproduce the same in my environment and got profile photo successfully like below:

image

To upload pictures to the Azure blob storage, you can refer the below link for more information in detail:

Use Microsoft Graph to Retrieve Users Photos and Store Them as Azure Blobs With C# – Mihai-Albert.com

  • Related