Forum Discussion
Brennen Cage
Apr 13, 2017Copper Contributor
Update SPO User Profile Properties with Azure AD AppOnly
Is it possible to update user profile properties in SharePoint Online using an Azure AD app for authentication/authorization? I am trying to authenticate to SharePoint using this PnP method AuthenticationManager().GetAzureADAppOnlyAuthenticatedContext, but when I try to update a user's profile property, I receive an
'Access denied. You do not have permission to perform this action or access this resource.' error. Do all user profile property updates have to have a user context (similar to Search and Taxonomy updates)? Using a user's context works flawlessly, but does not work with app only. The Azure AD app was also granted every permission available to rule out the correct permission level being chosen.
- Mikael SvensonSteel ContributorYou need an SP app with full tenant permissions + write to upa for this to work. Not possible with an AAD app today, at least last time I tried.
- Brennen CageCopper ContributorThanks for the response!
I found that the app only needs to have 'Manage' rights to the user profile if using a SharePoint App.
<AppPermissionRequests AllowAppOnlyPolicy="true">
<AppPermissionRequest Scope="http://sharepoint/social/tenant" Right="Manage" />
</AppPermissionRequests>
And to use a service account, the user only needs to have the SharePoint Administrator role. They don't need to have any product licenses in SharePoint Online.- Mikael SvensonSteel ContributorMy bad.. remebered it wrong. But glad you figured it out :)