Skip to content

Commit de2c3e7

Browse files
Merge pull request #79481 from rolyon/rolyon-rbac-remove-assignment
[Azure RBAC] Role assignments without a security principal
2 parents 5c43349 + e253ea3 commit de2c3e7

File tree

2 files changed

+59
-2
lines changed

2 files changed

+59
-2
lines changed

articles/role-based-access-control/role-assignments-powershell.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ms.devlang: na
1212
ms.topic: conceptual
1313
ms.tgt_pltfrm: na
1414
ms.workload: identity
15-
ms.date: 04/17/2019
15+
ms.date: 06/12/2019
1616
ms.author: rolyon
1717
ms.reviewer: bagovind
1818
---
@@ -362,6 +362,8 @@ Remove-AzRoleAssignment -ObjectId <object_id> -RoleDefinitionName <role_name> -S
362362
PS C:\> Remove-AzRoleAssignment -SignInName [email protected] -RoleDefinitionName "Virtual Machine Contributor" -ResourceGroupName pharma-sales
363363
```
364364

365+
If you get the error message: "The provided information does not map to a role assignment", make sure that you also specify the `-Scope` or `-ResourceGroupName` parameters. For more information, see [Troubleshoot RBAC for Azure resources](troubleshooting.md#role-assignments-without-a-security-principal).
366+
365367
## Next steps
366368

367369
- [Tutorial: Grant a group access to Azure resources using RBAC and Azure PowerShell](tutorial-role-assignments-group-powershell.md)

articles/role-based-access-control/troubleshooting.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ms.workload: identity
1212
ms.tgt_pltfrm: na
1313
ms.devlang: na
1414
ms.topic: conceptual
15-
ms.date: 05/13/2019
15+
ms.date: 06/12/2019
1616
ms.author: rolyon
1717
ms.reviewer: bagovind
1818
ms.custom: seohack1
@@ -49,6 +49,61 @@ This article answers common questions about role-based access control (RBAC) for
4949
- If you get the permissions error "The client with object id does not have authorization to perform action over scope (code: AuthorizationFailed)" when you try to create a resource, check that you are currently signed in with a user that is assigned a role that has write permission to the resource at the selected scope. For example, to manage virtual machines in a resource group, you should have the [Virtual Machine Contributor](built-in-roles.md#virtual-machine-contributor) role on the resource group (or parent scope). For a list of the permissions for each built-in role, see [Built-in roles for Azure resources](built-in-roles.md).
5050
- If you get the permissions error "You don't have permission to create a support request" when you try to create or update a support ticket, check that you are currently signed in with a user that is assigned a role that has the `Microsoft.Support/supportTickets/write` permission, such as [Support Request Contributor](built-in-roles.md#support-request-contributor).
5151

52+
## Role assignments without a security principal
53+
54+
When you list your role assignments using Azure PowerShell, you might see assignments with an empty `DisplayName` and an `ObjectType` set to Unknown. For example, [Get-AzRoleAssignment](/powershell/module/az.resources/get-azroleassignment) returns a role assignment that is similar to the following:
55+
56+
```azurepowershell
57+
RoleAssignmentId : /subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Authorization/roleAssignments/22222222-2222-2222-2222-222222222222
58+
Scope : /subscriptions/11111111-1111-1111-1111-111111111111
59+
DisplayName :
60+
SignInName :
61+
RoleDefinitionName : Storage Blob Data Contributor
62+
RoleDefinitionId : ba92f5b4-2d11-453d-a403-e96b0029c9fe
63+
ObjectId : 33333333-3333-3333-3333-333333333333
64+
ObjectType : Unknown
65+
CanDelegate : False
66+
```
67+
68+
Similarly, when you list your role assignments using Azure CLI, you might see assignments with an empty `principalName`. For example, [az role assignment list](/cli/azure/role/assignment#az-role-assignment-list) returns a role assignment that is similar to the following:
69+
70+
```azurecli
71+
{
72+
"canDelegate": null,
73+
"id": "/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Authorization/roleAssignments/22222222-2222-2222-2222-222222222222",
74+
"name": "22222222-2222-2222-2222-222222222222",
75+
"principalId": "33333333-3333-3333-3333-333333333333",
76+
"principalName": "",
77+
"roleDefinitionId": "/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Authorization/roleDefinitions/ba92f5b4-2d11-453d-a403-e96b0029c9fe",
78+
"roleDefinitionName": "Storage Blob Data Contributor",
79+
"scope": "/subscriptions/11111111-1111-1111-1111-111111111111",
80+
"type": "Microsoft.Authorization/roleAssignments"
81+
}
82+
```
83+
84+
These role assignments occur when you assign a role to a security principal (user, group, service principal, or managed identity) and you later delete that security principal. These role assignments aren't displayed in the Azure portal and it isn't a problem to leave them. However, if you like, you can remove these roles assignments.
85+
86+
To remove these role assignments, use the [Remove-AzRoleAssignment](/powershell/module/az.resources/remove-azroleassignment) or [az role assignment delete](/cli/azure/role/assignment#az-role-assignment-delete) commands.
87+
88+
In PowerShell, if you try to remove the role assignments using the object ID and role definition name, and more than one role assignment matches your parameters, you will get the error message: "The provided information does not map to a role assignment". The following shows an example of the error message:
89+
90+
```Example
91+
PS C:\> Remove-AzRoleAssignment -ObjectId 33333333-3333-3333-3333-333333333333 -RoleDefinitionName "Storage Blob Data Contributor"
92+
93+
Remove-AzRoleAssignment : The provided information does not map to a role assignment.
94+
At line:1 char:1
95+
+ Remove-AzRoleAssignment -ObjectId 33333333-3333-3333-3333-333333333333 ...
96+
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97+
+ CategoryInfo : CloseError: (:) [Remove-AzRoleAssignment], KeyNotFoundException
98+
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.RemoveAzureRoleAssignmentCommand
99+
```
100+
101+
If you get this error message, make sure you also specify the `-Scope` or `-ResourceGroupName` parameters.
102+
103+
```Example
104+
PS C:\> Remove-AzRoleAssignment -ObjectId 33333333-3333-3333-3333-333333333333 -RoleDefinitionName "Storage Blob Data Contributor" - Scope /subscriptions/11111111-1111-1111-1111-111111111111
105+
```
106+
52107
## RBAC changes are not being detected
53108

54109
Azure Resource Manager sometimes caches configurations and data to improve performance. When creating or deleting role assignments, it can take up to 30 minutes for changes to take effect. If you are using the Azure portal, Azure PowerShell, or Azure CLI, you can force a refresh of your role assignment changes by signing out and signing in. If you are making role assignment changes with REST API calls, you can force a refresh by refreshing your access token.

0 commit comments

Comments
 (0)