Azure / Azure/azure-powershell

[Feature]: Remove-AzRoleAssignment : Remove classical Administrator

Open
#21,110 2 comments 0 reactions 1 assignee Claimed by @isra-fel View on GitHub
Azure PS Team customer-reported feature-request Investigate :mag:
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description of the new feature

### Description
When using the command "Remove-AzRoleAssignment" unable to delete "Classical Administrator"

```
PS > $role = Get-AzRoleAssignment -IncludeClassicAdministrators | Where-Object {$_.RoleDefinitionName -like "*ServiceAdministrator*"}
PS > Remove-AzRoleAssignment -SignInName $role.SignInName -RoleDefinitionName "ServiceAdministrator" -Scope $role.Scope
```
### Error output
```
Remove-AzRoleAssignment : The provided information does not map to a role assignment.
Au caractère Ligne:1 : 1
+ Remove-AzRoleAssignment -SignInName $role.SignInName -RoleDefinitionN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError : (:) [Remove-AzRoleAssignment], KeyNotFoundException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.RemoveAzureRoleAssignmentCommand
```

### Proposed implementation details (optional)

Like the cmdlet Get-AzRoleAssignment include a parameter -IncludeClassicAdministrators to be able to delete Classical Admin

```
Get-AzRoleAssignment -IncludeClassicAdministrators

Remove-AzRoleAssignment -SignInName $SignInName -RoleDefinitionName "ServiceAdministrator" -Scope $Scope -IncludeClassicAdministrators
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.