Hi @nas shk
I just did a quick test locally, and it worked well.
Please ensure your context meets the following requirements:
- Ensure the photo you are uploading is less than 4 MB in size.
- Ensure you have the necessary permissions. If you are using "delegated permissions", make sure you are logged in as a Global Administrator or User Administrator to obtain the access token. If you are using "application permissions", make sure they are either
ProfilePhoto.ReadWrite.All
orUser.ReadWrite.All
. - Ensure the audience of your access token is the MS Graph API, not another API. You can decode the token and check the
aud
claim. - Ensure your tenant is not an Azure AD B2C. The Azure AD B2C tenants currently do not support updating user photos using the Microsoft Graph API.
Hope this helps.
If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.