Invoke-WebRequest : The remote server returned an error: (401) Unauthorized - Script to update photo to azure AD

Cédric Perion 171 Reputation points
2022-10-26T21:27:29.327+00:00

Hi all,

I try to make it work a script to update photo in azure AD with a upn name and i have error i dont understand to resolve :

Here the script ; https://alexholmeset.blog/2022/10/23/azure-ad-m365-profile-picture-uploader/

I create app and permissions required.

Error i have is :

254429-image.png

Thanks in advanced

Microsoft Security Microsoft Entra Microsoft Entra ID
Microsoft Security Microsoft Graph
{count} votes

2 answers

Sort by: Most helpful
  1. JimmySalian-2011 42,491 Reputation points
    2022-10-26T21:36:35.74+00:00

    Hi

    Looks like a permission issue to me, however check this thread with similar issue and fix provided by MSFT.

    Detailed process on the API - profilephoto-update

    unable-to-make-api-call-to-azure-registered-app-wi.html

    Hope this helps.
    JS

    ==
    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments

  2. Cédric Perion 171 Reputation points
    2022-10-26T22:27:10.443+00:00

    yeah already see this thread.
    Can you test in our end to see if it works ?

    Thanks


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.