Get-AzureRmRoleAssignment -SignInName -ExpandPrincipalGroups broken
Cmdlet(s)
Get-AzureRmRoleAssignment
PowerShell Version
Name Value
PSVersion 5.1.15063.674
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.15063.674
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Module Version
ModuleType Version Name
Script 4.0.0 AzureRM.profile
Script 5.0.0 AzureRM.Resources
Description
Get-AzureRmRoleAssignment -SignInName -ExpandPrincipalGroups was working correctly using Azurerm.Resources -version 4.1.0 and Azurerm.profile 3.1.0
The command was returning user role assignment based on direct user assignment and if the user was in the group or not. Since I have update the module this functionality is now returning a lot of different permission and not consistent.
Get-AzureRmRoleAssignment -SignInName [email protected] -ExpandPrincipalGroups
@cielakm Hey Marek, what are some of the inconsistencies you are seeing? Would you mind providing a few example outputs you are seeing for AzureRM 4.1.0 vs 5.0.0?
CC: @darshanhs90
Hi @cormacpayne thank you for looking in to this. Please find my note below.
If I run this command: Get-AzureRmRoleAssignment -SignInName [email protected] -ExpandPrincipalGroups | select DisplayName,SignInName,RoleDefinitionName,ObjectType,scope | ft
on 4.1.0
this is the output:

Which only displayed the groups that the user is a part of and have been assign to Sub, RG or resource.
If I run the same command on 5.0.0
this is the output:

It looks like it display information about all access permissions for anyone and any group in the scope of subscription,RG and resource.
This is not what is explained in this article https://docs.microsoft.com/en-us/azure/active-directory/role-based-access-control-manage-access-powershell
Hi @cormacpayne do you need any more info on this?
Fixed in the PR linked above, and will be included in the next release.
I want to make a csv with the infos of Get-AzureRoleAssignment. But I cant catch the atributes of each role of each resource group