merill / m365-gender-pronoun-kit

Helper scripts and guidance to add a Pronoun field (She/Her, They/Them, He/Him) to your Microsoft 365 tenant and display it in the Microsoft 365 profile card shown in Outlook, SharePoint, Delve...
MIT License
36 stars 1 forks source link

Error running Invoke-PronounSync.ps1 #4

Closed miked1428 closed 2 years ago

miked1428 commented 2 years ago

I'm getting an error that the current user in not a tenant administrator when running the Invoke-PronounSync.ps1 script. Also when it gets to a user that has the extension attribute set, it says updating even though it errors and doesn't update the field. image

The account that is running the script is a global administrator

KeithGillette commented 2 years ago

We are seeing the same Get-PnPUserProfileProperty : Current user is not tenant administrator. error running this PowerShell script in a global administrator account session. Did you find a solution, @miked1428?

merill commented 2 years ago

Are you using an app identity or user identity? Please see here for a resolution https://helloitsliam.com/2022/04/05/get-pnpuserprofileproperty-current-user-is-not-a-tenant-administrator/

KeithGillette commented 2 years ago

Thanks, @merill. We were able to eliminate the Get-PnPUserProfileProperty : Current user is not tenant administrator. error by correcting the app permissions. However, we now get the error Invoke-RestMethod : The remote server returned an error: (400) Bad Request. when the script hits a user that has the attribute set.

CITWil commented 2 years ago

Hi @KeithGillette or @merill I'm running some testing and the article does not talk about the steps to update/correct the permissions. Can you point me in the right direction? Also Liam does not mention if he is in admin or user context.

miked1428 commented 2 years ago

Hey CITWil,

In your Azure Active Directory console, look for "App Registrations". From there drill into your app and modify the API Permissions.