Forum Discussion
Sudharsan K
Mar 16, 2020Steel Contributor
Set-PnPUserProfileProperty with Application Permission in Azure Function
When using Set-PnPUserProfileProperty in Azure Function with Power Shell and the permissions has been defined using the Application Permission. Once connected to the admin site URL using client id, tenant and cert and try to update the User Profile Property, it throws the below error
Access denied. You do not have permission to perform this action or access this resource.
Attached the screenshot for the reference
Below are the permissions given for the application in Azure API Permissions
Hope someone already have a solution!
- AlexSenCopper ContributorHave exactly same issue, Module version 3.19.2003.0.
Set-PnPUserProfileProperty works without any issues.
App has max possible permissions- Sudharsan KSteel ContributorHi,
I used the latest version and I am still receiving the same issue, I am not able to update the User Profile Property.
- RonLevyCopper ContributorI run into the samme issue from an Azure Runbook.
I added a Secret to my App-Reg and added App-Only (ACS) for that App-Reg (addinv.aspx on admin-site). I added Sites.FullControl.All and User.ReadWrite.All for Graph and SharePoint to the API-Permissions of my App-Reg.
I then connected to the admin-site by client-id of my App-Reg and the secret:
Connect-PnPOnline -Url $adminUrl -ClientId $clientId -ClientSecret $clientSecret
With that, i was able to update the ups property.
Set-PnPUserProfileProperty -Account $UserAccount -PropertyName "SBU" -Value $sbu
May you can adapt the settings. Or this may help others...