Edit

Remove-AzRoleAssignment

Delete an Azure RBAC role assignment.

Syntax

SubscriptionScope (Default)

Remove-AzRoleAssignment
    -Name <string>
    [-SubscriptionId <string>]
    [-Profile <string>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ResourceGroup

Remove-AzRoleAssignment
    -ResourceGroupName <string>
    -Name <string>
    [-SubscriptionId <string>]
    [-Profile <string>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Scope

Remove-AzRoleAssignment
    -Scope <string>
    -Name <string>
    [-Profile <string>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Delete an Azure role-based access control (RBAC) role assignment by scope and name. The scope defaults to the active subscription and can be narrowed with -ResourceGroupName or overridden with -Scope (the two are mutually exclusive). -Name (the assignment's GUID) is required: this targets exactly one already-known assignment. Deleting by principal/role filter, or deleting every assignment at a scope, is not supported — use Get-AzRoleAssignment first to find the assignment's name.

Examples

Delete a role assignment by name at a resource group scope

Remove-AzRoleAssignment -ResourceGroupName my-rg -Name aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee

Delete a role assignment at an explicit scope

Remove-AzRoleAssignment -Scope /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg -Name aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

The role assignment name (a GUID) to delete.

Parameter properties

Type:String
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Profile

Name of a saved profile to use for this call instead of the currently-active one. Manage profiles with Set-AzProfile / Get-AzProfile.

Parameter properties

Type:String
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceGroupName

Delete the role assignment scoped to this resource group under the subscription. Mutually exclusive with -Scope.

Parameter properties

Type:String
Supports wildcards:False
DontShow:False

Parameter sets

ResourceGroup
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Scope

Fully qualified scope to delete the role assignment from (the delete target). Mutually exclusive with -ResourceGroupName. Defaults to the subscription scope.

Parameter properties

Type:String
Supports wildcards:False
DontShow:False

Parameter sets

Scope
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SubscriptionId

Azure Subscription Id. Defaults to the active profile's subscription.

Parameter properties

Type:String
Supports wildcards:False
DontShow:False

Parameter sets

SubscriptionScope
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ResourceGroup
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Runs the command in a mode that only reports what would happen without performing the actions.

Parameter properties

Type:SwitchParameter
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

Microsoft.Azure.Azclips.Extensions.Resources.Models.RoleAssignment

The deleted RoleAssignment, including its id, name, and properties (role definition id, principal id and type, and scope). ARM returns no content when the assignment did not exist, so nothing is written to the pipeline in that case.