New-AzRoleAssignment
在指定范围内将指定的 RBAC 角色分配给指定的主体。
cmdlet 可以根据输入参数调用以下Microsoft图形 API:
- 获取 /users/{id}
- 获取 /servicePrincipals/{id}
- 获取 /groups/{id}
- 获取 /directoryObjects/{id}
请注意,如果未找到角色分配对象或当前帐户没有足够的权限来获取对象类型,此 cmdlet 将标记为ObjectType
Unknown
输出中。
语法
EmptyParameterSet (默认值)
New-AzRoleAssignment
-ObjectId <String>
-RoleDefinitionName <String>
[-Scope <String>]
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ResourceGroupWithObjectIdParameterSet
New-AzRoleAssignment
-ObjectId <String>
-ResourceGroupName <String>
-RoleDefinitionName <String>
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ResourceWithObjectIdParameterSet
New-AzRoleAssignment
-ObjectId <String>
-ResourceGroupName <String>
-ResourceName <String>
-ResourceType <String>
-RoleDefinitionName <String>
[-ParentResource <String>]
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
RoleIdWithScopeAndObjectIdParameterSet
New-AzRoleAssignment
-ObjectId <String>
-Scope <String>
-RoleDefinitionId <Guid>
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ResourceGroupWithSignInNameParameterSet
New-AzRoleAssignment
-SignInName <String>
-ResourceGroupName <String>
-RoleDefinitionName <String>
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ResourceWithSignInNameParameterSet
New-AzRoleAssignment
-SignInName <String>
-ResourceGroupName <String>
-ResourceName <String>
-ResourceType <String>
-RoleDefinitionName <String>
[-ParentResource <String>]
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ScopeWithSignInNameParameterSet
New-AzRoleAssignment
-SignInName <String>
-RoleDefinitionName <String>
[-Scope <String>]
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ResourceGroupWithSPNParameterSet
New-AzRoleAssignment
-ApplicationId <String>
-ResourceGroupName <String>
-RoleDefinitionName <String>
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ResourceWithSPNParameterSet
New-AzRoleAssignment
-ApplicationId <String>
-ResourceGroupName <String>
-ResourceName <String>
-ResourceType <String>
-RoleDefinitionName <String>
[-ParentResource <String>]
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ScopeWithSPNParameterSet
New-AzRoleAssignment
-ApplicationId <String>
-RoleDefinitionName <String>
[-Scope <String>]
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzRoleAssignment
-InputFile <String>
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
说明
使用 New-AzRoleAssignment 命令授予访问权限。
通过将适当的 RBAC 角色分配到适当的范围授予访问权限。
若要授予对整个订阅的访问权限,请在订阅范围内分配角色。
若要授予对订阅中特定资源组的访问权限,请在资源组范围内分配角色。
必须指定工作分配的主题。
若要指定用户,请使用 SignInName 或 Microsoft Entra ObjectId 参数。
若要指定安全组,请使用 Microsoft Entra ObjectId 参数。
若要指定 Microsoft Entra 应用程序,请使用 ApplicationId 或 ObjectId 参数。
必须使用 RoleDefinitionName 参数指定所分配的角色。
可以指定授予访问权限的范围。
默认为所选订阅。
可以使用以下参数组合之一指定分配的范围。
范围 - 这是从 /subscriptions/<subscriptionId> b 开始的完全限定范围。
ResourceGroupName - 授予对指定资源组的访问权限。
选项c.
ResourceName、ResourceType、ResourceGroupName 和 (可选)ParentResource - 指定资源组中的特定资源以授予访问权限。
示例
示例 1
New-AzRoleAssignment -ResourceGroupName rg1 -SignInName allen.young@live.com -RoleDefinitionName Reader -AllowDelegation
授予读者角色对资源组范围内的用户的访问权限,该角色分配可用于委派
示例 2
Get-AzADGroup -SearchString "Christine Koch Team"
DisplayName Type Id
----------- ---- --------
Christine Koch Team 2f9d4375-cbf1-48e8-83c9-2a0be4cb33fb
New-AzRoleAssignment -ObjectId 2f9d4375-cbf1-48e8-83c9-2a0be4cb33fb -RoleDefinitionName Contributor -ResourceGroupName rg1
授予对安全组的访问权限
示例 3
New-AzRoleAssignment -SignInName john.doe@contoso.com -RoleDefinitionName Owner -Scope "/subscriptions/00001111-aaaa-2222-bbbb-3333cccc4444/resourcegroups/rg1/providers/Microsoft.Web/sites/site1"
授予对资源(网站)用户的访问权限
示例 4
New-AzRoleAssignment -ObjectId 00001111-aaaa-2222-bbbb-3333cccc4444 -RoleDefinitionName "Virtual Machine Contributor" -ResourceName Devices-Engineering-ProjectRND -ResourceType Microsoft.Network/virtualNetworks/subnets -ParentResource virtualNetworks/VNET-EASTUS-01 -ResourceGroupName Network
向嵌套资源(子网)中的组授予访问权限
示例 5
$servicePrincipal = New-AzADServicePrincipal -DisplayName "testServiceprincipal"
New-AzRoleAssignment -RoleDefinitionName "Reader" -ApplicationId $servicePrincipal.ApplicationId
授予读者对服务主体的访问权限
示例 6
$Condition = '(
(
!(ActionMatches{''Microsoft.Authorization/roleAssignments/write''})
)
OR
(
@Request[Microsoft.Authorization/roleAssignments:PrincipalType] StringEqualsIgnoreCase ''ServicePrincipal''
)
)
AND
(
(
!(ActionMatches{''Microsoft.Authorization/roleAssignments/delete''})
)
OR
(
@Resource[Microsoft.Authorization/roleAssignments:PrincipalType] StringEqualsIgnoreCase ''ServicePrincipal''
)
)'
$DelegationParams = @{
AllowDelegation = $true
Condition = $Condition
Scope = "/subscriptions/11112222-bbbb-3333-cccc-4444dddd5555"
RoleDefinitionName = 'User Access Administrator'
ObjectId = "00001111-aaaa-2222-bbbb-3333cccc4444"
}
New-AzRoleAssignment @DelegationParams
通过受约束委派的 Azure 订阅授予用户访问管理员。
约束委派将只允许委派的用户/服务主体/组只能为服务主体和任何角色创建/删除/更新新角色分配。
示例 7
$Condition = '(
(
!(ActionMatches{''Microsoft.Authorization/roleAssignments/write''})
)
OR
(
@Request[Microsoft.Authorization/roleAssignments:PrincipalType] StringEqualsIgnoreCase ''ServicePrincipal''
AND
NOT @Request[Microsoft.Authorization/roleAssignments:RoleDefinitionId] ForAnyOfAnyValues:GuidEquals {8e3af657-a8ff-443c-a75c-2fe8c4bcb635,18d7d88d-d35e-4fb5-a5c3-7773c20a72d9}
)
)
AND
(
(
!(ActionMatches{''Microsoft.Authorization/roleAssignments/delete''})
)
OR
(
@Resource[Microsoft.Authorization/roleAssignments:PrincipalType] StringEqualsIgnoreCase ''ServicePrincipal''
AND
NOT @Resource[Microsoft.Authorization/roleAssignments:RoleDefinitionId] ForAnyOfAnyValues:GuidEquals {8e3af657-a8ff-443c-a75c-2fe8c4bcb635,18d7d88d-d35e-4fb5-a5c3-7773c20a72d9}
)
)'
$DelegationParams = @{
AllowDelegation = $true
Condition = $Condition
Scope = "/subscriptions/11112222-bbbb-3333-cccc-4444dddd5555"
RoleDefinitionName = 'User Access Administrator'
ObjectId = "00001111-aaaa-2222-bbbb-3333cccc4444"
}
New-AzRoleAssignment @DelegationParams
通过受约束委派的 Azure 订阅授予用户访问管理员。
约束委派仅允许委派的用户/服务主体/组只能为服务主体创建/删除/更新新角色分配,不包括 所有者 和 用户访问管理员 角色。
参数
-AllowDelegation
创建角色分配时委派标志。
参数属性
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-ApplicationId
ServicePrincipal 的应用程序 ID
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
别名: | SPN, 服务主体名称 (ServicePrincipalName) |
参数集
ResourceGroupWithSPNParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSPNParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ScopeWithSPNParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-Condition
要应用于 RoleAssignment 的条件。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
EmptyParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithObjectIdParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithObjectIdParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
RoleIdWithScopeAndObjectIdParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithSignInNameParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSignInNameParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ScopeWithSignInNameParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithSPNParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSPNParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ScopeWithSPNParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-ConditionVersion
条件的版本。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
EmptyParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithObjectIdParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithObjectIdParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
RoleIdWithScopeAndObjectIdParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithSignInNameParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSignInNameParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ScopeWithSignInNameParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithSPNParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSPNParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ScopeWithSPNParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-DefaultProfile
用于与 azure 通信的凭据、帐户、租户和订阅
参数属性
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-Description
角色分配的简要说明。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
EmptyParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithObjectIdParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithObjectIdParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
RoleIdWithScopeAndObjectIdParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithSignInNameParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSignInNameParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ScopeWithSignInNameParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithSPNParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSPNParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ScopeWithSPNParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
角色分配 json 的路径
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
InputFileParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-ObjectId
Microsoft用户、组或服务主体的 Entra Objectid。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
别名: | Id, PrincipalId |
参数集
EmptyParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithObjectIdParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithObjectIdParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
RoleIdWithScopeAndObjectIdParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-ObjectType
与 ObjectId 一起使用。 指定被赋值方对象的类型
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
别名: | 主体类型 |
参数集
EmptyParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithObjectIdParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithObjectIdParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
RoleIdWithScopeAndObjectIdParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithSignInNameParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSignInNameParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ScopeWithSignInNameParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithSPNParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSPNParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ScopeWithSPNParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-ParentResource
层次结构中的父资源(使用 ResourceName 参数指定的资源)。
应仅与 ResourceGroupName、ResourceType 和 ResourceName 参数结合使用,以标识资源的相对 URI 的形式构造分层范围。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
ResourceWithObjectIdParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSignInNameParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSPNParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-ResourceGroupName
资源组名称。
创建在指定资源组中有效的分配。
与 ResourceName、ResourceType 和 (可选)ParentResource 参数结合使用时,该命令以标识资源的相对 URI 的形式构造分层范围。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
ResourceGroupWithObjectIdParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithObjectIdParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithSignInNameParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSignInNameParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithSPNParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSPNParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-ResourceName
资源名称。
例如 storageaccountprod。
应仅与 ResourceGroupName、ResourceType 和 (可选)ParentResource 参数结合使用,以标识资源的相对 URI 的形式构造分层范围。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
ResourceWithObjectIdParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSignInNameParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSPNParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-ResourceType
资源类型。
例如,Microsoft.Network/virtualNetworks。
应仅与 ResourceGroupName、ResourceName 和 (可选)ParentResource 参数结合使用,以标识资源的相对 URI 的形式构造分层范围。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
ResourceWithObjectIdParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSignInNameParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSPNParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-RoleDefinitionId
需要分配给主体的 RBAC 角色的 ID。
参数属性
类型: | Guid
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
RoleIdWithScopeAndObjectIdParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-RoleDefinitionName
需要分配给主体的 RBAC 角色的名称,例如读者、参与者、虚拟网络管理员等。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
EmptyParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithObjectIdParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithObjectIdParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithSignInNameParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSignInNameParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ScopeWithSignInNameParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceGroupWithSPNParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSPNParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ScopeWithSPNParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-Scope
角色分配的范围。
相对 URI 的格式。
例如“/subscriptions/9004a9fd-d58e-48dc-aeb2-4a4aec58606f/resourceGroups/TestRG”。
如果未指定,将在订阅级别创建角色分配。
如果指定,它应以“/subscriptions/{id}”开头。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
EmptyParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ScopeWithSignInNameParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ScopeWithSPNParameterSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-SignInName
用户的电子邮件地址或用户主体名称。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
别名: | Email, UserPrincipalName |
参数集
ResourceGroupWithSignInNameParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ResourceWithSignInNameParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
ScopeWithSignInNameParameterSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-SkipClientSideScopeValidation
如果指定,请跳过客户端范围验证。
参数属性
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。
输出
备注