I am trying to use Azure Powershell (AZ powershell module) inside docker container to create/modify office 365 related configurations including user profiles.
I am trying to change user password using service principal. I have got the following error while using Update-AzADUser. However, I could create the user and modify the display name. I was having issues only with the change password or removing the user.
PS />
Update-AzADUser -ObjectId xyz358c2... -Password $password
Update-AzADUser : Insufficient privileges to complete the operation.
At line:1 char:1
+Update-AzADUser -ObjectId xyz358c2... -Passw ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Update-AzADUser], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ActiveDirectory.UpdateAzureADUserCommand
On the service principal, I have provided all available application permission and delegated permissions on Microsoft Graph API and Windows Azure Active Directory.
I can't find any of the AD roles that are available in https://docs.microsoft.com/en-us/azure/active-directory/users-groups-roles/directory-assign-admin-roles to assign to the service principal. Please screenshots on the below links.
Add-AzureADDirectoryRoleMemberandGet-AzureADServicePrincipal.. In terms of directory role something likeHelpdesk admninstratorshould do at least for resetting passwords for non-admin users.. you can choose a more privileged directory role than that if need be based on your requirements.. - Rohit Saigal