共用方式為


Remove-AzRoleDefinition

刪除 Azure RBAC 中的自定義角色。 要刪除的角色是使用角色的 Id 屬性來指定。 如果對自定義角色進行現有的角色指派,刪除將會失敗。

語法

Remove-AzRoleDefinition
      -Id <Guid>
      [-Scope <String>]
      [-SkipClientSideScopeValidation]
      [-Force]
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzRoleDefinition
      [-Name] <String>
      [-Scope <String>]
      [-SkipClientSideScopeValidation]
      [-Force]
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzRoleDefinition
      -InputObject <PSRoleDefinition>
      [-SkipClientSideScopeValidation]
      [-Force]
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

Remove-AzRoleDefinition Cmdlet 會刪除 Azure Role-Based 存取控制中的自訂角色。 提供現有自定義角色的Id參數,以刪除該自定義角色。 根據預設,Remove-AzRoleDefinition 會提示您確認。 若要隱藏提示,請使用 Force 參數。 如果有對自定義角色進行刪除的現有角色指派,刪除將會失敗。

範例

範例 1

Get-AzRoleDefinition -Name "Virtual Machine Operator" | Remove-AzRoleDefinition

範例 2

Remove-AzRoleDefinition -Id "00001111-aaaa-2222-bbbb-3333cccc4444"

參數

-Confirm

在執行 Cmdlet 之前,提示您進行確認。

類型:SwitchParameter
別名:cf
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-DefaultProfile

用於與 azure 通訊的認證、帳戶、租用戶和訂用帳戶

類型:IAzureContextContainer
別名:AzContext, AzureRmContext, AzureCredential
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Force

如果已設定,則不會在刪除自定義角色之前提示確認

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Id

要刪除的角色定義標識碼

類型:Guid
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-InputObject

物件,表示要移除的角色定義。

類型:PSRoleDefinition
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-Name

要刪除的角色定義名稱。

類型:String
Position:0
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-PassThru

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Scope

角色定義範圍。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-SkipClientSideScopeValidation

如果指定,請略過客戶端範圍驗證。

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-WhatIf

類型:SwitchParameter
別名:wi
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

輸入

Guid

String

PSRoleDefinition

輸出

Boolean

備註

關鍵詞:azure, azurerm, arm, 資源, 管理, 管理員, 資源, 群組, 範本, 部署