Hi,
I'm currently facing an access denied issue, but I didn't found the root cause.
I wrote a PowerShell script that create User Profile and synchronize the properties. So far, the script is running well with the Farm account.
Now my goal is to switch the execution of the script to dedicated service account.
So I gave the following permission:
- Local Admin of the server and SharePoint_Shell_Access of SharePoint Config DB, in order to have the possibility to load the SharePoint snapin.
- Give Full Control permissions on User Profile Service Application. I also gave the Full Control for Administrators of User Profile (but I don't think this one is necessary).
With this, the script is able to execute the following commands:
$context = Get-SPServiceContext($site)
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
$upm.UserExists($claimIdUser)
But return an access denied on this command:
$userProfile = $upm.GetUserProfile($claimIdUser)
Error details:
System.Management.Automation.MethodInvocationException
Exception calling "GetUserProfile" with "1" argument(s): "UserProfileDBCache_WCFLogging
:: ProfileDBCacheServiceClient.GetUserData threw exception: Access is denied."
In ULS logs I have:
Unable to write service call usage entry.
ChannelInvoke::GetUserData::1 -- CommunicationException occurred: System.ServiceModel.Security.SecurityAccessDeniedException: Access is denied.
UserProfile.RetrieveUser() Exception: Microsoft.Office.Server.UserProfiles.UserProfileApplicationNotAvailableException: UserProfileDBCache_WCFLogging :: ProfileDBCacheServiceClient.GetUserData threw exception: Access is denied. ---> System.ServiceModel.Security.SecurityAccessDeniedException: Access is denied.
GetUserProfile_RetrieveUser_Cache Failure: RetrieveUser_Cache: Failed because of Exception Microsoft.Office.Server.UserProfiles.UserProfileApplicationNotAvailableException: UserProfileDBCache_WCFLogging :: ProfileDBCacheServiceClient.GetUserData threw exception: Access is denied. ---> System.ServiceModel.Security.SecurityAccessDeniedException: Access is denied.
I don't see what permission is missing. Any idea ?
Kind regards,
jlmsy