Azure / Azure/azure-powershell
[Feature]: Remove-AzRoleAssignment : Remove classical Administrator
- 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
Assessment
This issue has not been assessed yet.