I would like to get a list of AzureDirectory roles that assigned to a specific user by powershell .. i tried many commands but keep getting the error :
Get-AzRoleAssignment -SignInName "firstname.lastname@example.org"
Get-AzRoleAssignment : Object reference not set to an instance of an object.
At line:1 char:1
+ Get-AzRoleAssignment -SignInName "email@example.com"
+ CategoryInfo : CloseError: (:) [Get-AzRoleAssignment], NullReferenceExceptio
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleAssignmentComm
I ran connect-azureAD before running the command above.
my nex question is how can i compare or copy the azuredirectory assigned role from one user to another user? the roles are administrative azure roles.
we have 5 admins and when a new admin account is being created so its useful to copy the same roles from one admin to another admin as each admin has many roles.