Deletes a custom role in Azure RBAC.
The role to be deleted is specified using the Id property of the role.
Delete will fail if there are existing role assignments made to the custom role.
The Remove-AzRoleDefinition cmdlet deletes a custom role in Azure Role-Based Access Control.
Provide the Id parameter of an existing custom role to delete that custom role.
By default, Remove-AzRoleDefinition prompts you for confirmation.
To suppress the prompt, use the Force parameter.
If there are existing role assignments made to the custom role to be deleted, the delete will fail.
When using the -PassThru parameter, the cmdlet returns the deleted PSRoleDefinition object.
The returned object contains a Permissions collection with Actions, NotActions, DataActions, NotDataActions, and any Attribute-Based Access Control (ABAC) conditions (Condition and ConditionVersion) for each permission entry.
Examples
Example 1: Remove a custom role by piping from Get-AzRoleDefinition
Retrieves the "Virtual Machine Operator" custom role and pipes it to Remove-AzRoleDefinition for deletion.
You will be prompted for confirmation before the role is deleted.
The Remove-AzRoleDefinition cmdlet deletes a custom role in Azure Role-Based Access Control.
Provide the Id parameter of an existing custom role to delete that custom role.
By default, Remove-AzRoleDefinition prompts you for confirmation.
To suppress the prompt, use the Force parameter.
If there are existing role assignments made to the custom role to be deleted, the delete will fail.
When using the -PassThru parameter, the cmdlet returns the deleted PSRoleDefinition object.
The returned object contains a Permissions collection with Actions, NotActions, DataActions, NotDataActions, and any Attribute-Based Access Control (ABAC) conditions (Condition and ConditionVersion) for each permission entry.
The Remove-AzRoleDefinition cmdlet deletes a custom role in Azure Role-Based Access Control.
Provide the Id parameter of an existing custom role to delete that custom role.
By default, Remove-AzRoleDefinition prompts you for confirmation.
To suppress the prompt, use the Force parameter.
If there are existing role assignments made to the custom role to be deleted, the delete will fail.
When using the -PassThru parameter, the cmdlet returns the deleted PSRoleDefinition object.
The returned object contains a Permissions collection with Actions, NotActions, DataActions, NotDataActions, and any Attribute-Based Access Control (ABAC) conditions (Condition and ConditionVersion) for each permission entry.
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.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.