question

sarmednazar-1917 avatar image
0 Votes"
sarmednazar-1917 asked sarmednazar-1917 commented

get list of AzureDirectory roles that assigned for a specific user by powershell

Hi Support

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 "xxxxx@yyy.com"
Get-AzRoleAssignment : Object reference not set to an instance of an object.
At line:1 char:1
+ Get-AzRoleAssignment -SignInName "xxx@yyy.com"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzRoleAssignment], NullReferenceExceptio
n
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleAssignmentComm
and



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.


Best regards
Sam

azure-active-directorywindows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

isdataninja avatar image
0 Votes"
isdataninja answered sarmednazar-1917 commented

You need to use Connect-AzAccount from Az modules instead of Connect-AzureAD from the AzureAD module.

GOfahYm.png


· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi

Thank you for your reply

I did update for all my installed PS modules and i followed your guide but keep getting this error as you can see on my atatched file
141307-azure-assignment-issue.jpg





Best regards
Sam

0 Votes 0 ·

your screenshot shows that your account that you logged into does not have any subscriptions

0 Votes 0 ·

still need help?

0 Votes 0 ·

Hi

I dont have any subscription but we have many administrativ roles in our Azure .. så is this the reason that why i can not see the result?

Best regards
Sam

0 Votes 0 ·