Error : Get-AzRoleassignement : Cannot find principal using the specified options
Error : Get-AzRoleassignement : Cannot find principal using the specified options
目前powershell脚本还不是很厉害,在一天天学习中
有人可以帮助从 Azure 获取所有用户的详细信息,以便他们使用 expandprinipalgroups 进行角色分配
我已经为一个用户尝试过并且它工作正常但是当我运行查询所有azusers然后它给出错误
我正在尝试低于一个
$user = (Get-AzADUser).UserPrincipalname
Get-AzRoleAssignment -SignInName $user -ExpandPrincipalGroups | Select-对象显示名称、角色定义名称、范围
Get-AzRoleAssignment -SignInName $user -ExpandPrincipalGroups | Select-对象显示名称、角色定义名称、范围
Get-AzRoleAssignment:无法使用指定的选项找到主体
在 line:1 char:1
- Get-AzRoleAssignment -SignInName $user -ExpandPrincipalGroups |选择 ...
-
+ CategoryInfo : CloseError: (:) [Get-AzRoleAssignment], KeyNotFoundException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleAssignmentCommand
欢迎回来苏瑞,
您需要将命令 Get-AzRoleAssignment
的参数 SignInName
作为字符串而不是列表传递
Get-AzRoleAssignment
-SignInName <String>
-ResourceGroupName <String>
[-RoleDefinitionName <String>]
[-IncludeClassicAdministrators]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
因此可以按以下方式处理
(Get-AzADUser).UserPrincipalname | % { Get-AzRoleAssignment -SignInName $_ | Select-Object DisplayName,RoleDefinitionName,Scope}
DisplayName RoleDefinitionName Scope
----------- ------------------ -----
Mahmoud Moawad Owner /subscriptions/XXXXX-XXXX-XXXXX-XXXX-XXXX
Mahmoud Moawad User Access Administrator /
目前powershell脚本还不是很厉害,在一天天学习中
有人可以帮助从 Azure 获取所有用户的详细信息,以便他们使用 expandprinipalgroups 进行角色分配
我已经为一个用户尝试过并且它工作正常但是当我运行查询所有azusers然后它给出错误
我正在尝试低于一个
$user = (Get-AzADUser).UserPrincipalname
Get-AzRoleAssignment -SignInName $user -ExpandPrincipalGroups | Select-对象显示名称、角色定义名称、范围
Get-AzRoleAssignment -SignInName $user -ExpandPrincipalGroups | Select-对象显示名称、角色定义名称、范围 Get-AzRoleAssignment:无法使用指定的选项找到主体 在 line:1 char:1
- Get-AzRoleAssignment -SignInName $user -ExpandPrincipalGroups |选择 ...
-
+ CategoryInfo : CloseError: (:) [Get-AzRoleAssignment], KeyNotFoundException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.GetAzureRoleAssignmentCommand
欢迎回来苏瑞,
您需要将命令 Get-AzRoleAssignment
的参数 SignInName
作为字符串而不是列表传递
Get-AzRoleAssignment
-SignInName <String>
-ResourceGroupName <String>
[-RoleDefinitionName <String>]
[-IncludeClassicAdministrators]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
因此可以按以下方式处理
(Get-AzADUser).UserPrincipalname | % { Get-AzRoleAssignment -SignInName $_ | Select-Object DisplayName,RoleDefinitionName,Scope}
DisplayName RoleDefinitionName Scope
----------- ------------------ -----
Mahmoud Moawad Owner /subscriptions/XXXXX-XXXX-XXXXX-XXXX-XXXX
Mahmoud Moawad User Access Administrator /