Skip to content

Commit 7bc8365

Browse files
authored
Merge pull request #77026 from rolyon/rolyon-rbac-deny-powershell
[Azure RBAC] Deny assignments using PowerShell
2 parents cc67a35 + 0a061e8 commit 7bc8365

File tree

6 files changed

+178
-30
lines changed

6 files changed

+178
-30
lines changed

articles/role-based-access-control/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
href: deny-assignments.md
5555
- name: Portal
5656
href: deny-assignments-portal.md
57+
- name: PowerShell
58+
href: deny-assignments-powershell.md
5759
- name: REST API
5860
href: deny-assignments-rest.md
5961
- name: Custom roles

articles/role-based-access-control/deny-assignments-portal.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: View deny assignments for Azure resources using the Azure portal | Microsoft Docs
3-
description: Learn how to view the users, groups, service principals, and managed identities that have been denied access to specific Azure resource actions at particular scope using the Azure portal.
2+
title: List deny assignments for Azure resources using the Azure portal | Microsoft Docs
3+
description: Learn how to list the users, groups, service principals, and managed identities that have been denied access to specific Azure resource actions at particular scopes using the Azure portal.
44
services: active-directory
55
documentationcenter: ''
66
author: rolyon
@@ -12,31 +12,31 @@ ms.devlang: na
1212
ms.topic: conceptual
1313
ms.tgt_pltfrm: na
1414
ms.workload: identity
15-
ms.date: 03/13/2019
15+
ms.date: 06/10/2019
1616
ms.author: rolyon
1717
ms.reviewer: bagovind
1818
---
1919

20-
# View deny assignments for Azure resources using the Azure portal
20+
# List deny assignments for Azure resources using the Azure portal
2121

22-
[Deny assignments](deny-assignments.md) block users from performing specific Azure resource actions even if a role assignment grants them access. This article describes how to use the Azure portal to view deny assignments.
22+
[Deny assignments](deny-assignments.md) block users from performing specific Azure resource actions even if a role assignment grants them access. This article describes how to list deny assignments using the Azure portal.
2323

2424
> [!NOTE]
25-
> At this time, the only way you can add your own deny assignments is by using Azure Blueprints. For more information, see [Protect new resources with Azure Blueprints resource locks](../governance/blueprints/tutorials/protect-new-resources.md).
25+
> You can't directly create your own deny assignments. For information about how deny assignments are created, see [Deny assignments](deny-assignments.md).
2626
2727
## Prerequisites
2828

2929
To get information about a deny assignment, you must have:
3030

3131
- `Microsoft.Authorization/denyAssignments/read` permission, which is included in most [built-in roles for Azure resources](built-in-roles.md).
3232

33-
## View deny assignments
33+
## List deny assignments
3434

35-
Follow these steps to view deny assignments at the subscription or management group scope.
35+
Follow these steps to list deny assignments at the subscription or management group scope.
3636

3737
1. In the Azure portal, click **All services** and then **Management groups** or **Subscriptions**.
3838

39-
1. Click the management group or subscription you want to view.
39+
1. Click the management group or subscription you want to list.
4040

4141
1. Click **Access control (IAM)**.
4242

@@ -63,9 +63,9 @@ Follow these steps to view deny assignments at the subscription or management gr
6363

6464
1. Add a checkmark to any of the enabled items and then click **OK** to display the selected columns.
6565

66-
## View details about a deny assignment
66+
## List details about a deny assignment
6767

68-
Follow these steps to view additional details about a deny assignment.
68+
Follow these steps to list additional details about a deny assignment.
6969

7070
1. Open the **Deny assignments** pane as described in the previous section.
7171

@@ -106,4 +106,4 @@ Follow these steps to view additional details about a deny assignment.
106106
## Next steps
107107

108108
* [Understand deny assignments for Azure resources](deny-assignments.md)
109-
* [List deny assignments for Azure resources using the REST API](deny-assignments-rest.md)
109+
* [List deny assignments for Azure resources using Azure PowerShell](deny-assignments-powershell.md)
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
title: List deny assignments for Azure resources using Azure PowerShell | Microsoft Docs
3+
description: Learn how to list the users, groups, service principals, and managed identities that have been denied access to specific Azure resource actions at particular scopes using Azure PowerShell.
4+
services: active-directory
5+
documentationcenter: ''
6+
author: rolyon
7+
manager: mtillman
8+
9+
ms.service: role-based-access-control
10+
ms.devlang: na
11+
ms.topic: conceptual
12+
ms.tgt_pltfrm: na
13+
ms.workload: identity
14+
ms.date: 06/12/2019
15+
ms.author: rolyon
16+
ms.reviewer: bagovind
17+
---
18+
19+
# List deny assignments for Azure resources using Azure PowerShell
20+
21+
[Deny assignments](deny-assignments.md) block users from performing specific Azure resource actions even if a role assignment grants them access. This article describes how to list deny assignments using Azure PowerShell.
22+
23+
> [!NOTE]
24+
> You can't directly create your own deny assignments. For information about how deny assignments are created, see [Deny assignments](deny-assignments.md).
25+
26+
## Prerequisites
27+
28+
To get information about a deny assignment, you must have:
29+
30+
- `Microsoft.Authorization/denyAssignments/read` permission, which is included in most [built-in roles for Azure resources](built-in-roles.md)
31+
- [PowerShell in Azure Cloud Shell](/azure/cloud-shell/overview) or [Azure PowerShell](/powershell/azure/install-az-ps)
32+
33+
## List deny assignments
34+
35+
### List all deny assignments
36+
37+
To list all deny assignments for the current subscription, use [Get-AzDenyAssignment](/powershell/module/az.resources/get-azdenyassignment).
38+
39+
```azurepowershell
40+
Get-AzDenyAssignment
41+
```
42+
43+
```Example
44+
PS C:\> Get-AzDenyAssignment
45+
46+
Id : 22222222-2222-2222-2222-222222222222
47+
DenyAssignmentName : Deny assignment '22222222-2222-2222-2222-222222222222' created by Blueprint Assignment
48+
'/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Blueprint/blueprintAssignments/assignment-locked-storageaccount-TestingBPLocks'.
49+
Description : Created by Blueprint Assignment '/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Blueprint/blueprintAssignments/assignment-locked-storageaccount-TestingBPLocks'.
50+
Actions : {*}
51+
NotActions : {*/read}
52+
DataActions : {}
53+
NotDataActions : {}
54+
Scope : /subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/TestingBPLocks
55+
DoNotApplyToChildScopes : True
56+
Principals : {
57+
DisplayName: All Principals
58+
ObjectType: SystemDefined
59+
ObjectId: 00000000-0000-0000-0000-000000000000
60+
}
61+
ExcludePrincipals : {
62+
ObjectType: ServicePrincipal
63+
}
64+
IsSystemProtected : True
65+
66+
Id : 33333333-3333-3333-3333-333333333333
67+
DenyAssignmentName : Deny assignment '33333333-3333-3333-3333-333333333333' created by Blueprint Assignment
68+
'/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Blueprint/blueprintAssignments/assignment-locked-storageaccount-TestingBPLocks'.
69+
Description : Created by Blueprint Assignment '/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Blueprint/blueprintAssignments/assignment-locked-storageaccount-TestingBPLocks'.
70+
Actions : {*}
71+
NotActions : {*/read}
72+
DataActions : {}
73+
NotDataActions : {}
74+
Scope : /subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/TestingBPLocks/providers/Microsoft.Storage/storageAccounts/storep6vkuxmu4m4pq
75+
DoNotApplyToChildScopes : True
76+
Principals : {
77+
DisplayName: All Principals
78+
ObjectType: SystemDefined
79+
ObjectId: 00000000-0000-0000-0000-000000000000
80+
}
81+
ExcludePrincipals : {
82+
DisplayName: assignment-locked-storageaccount-TestingBPLocks
83+
ObjectType: ServicePrincipal
84+
ObjectId: 2311a0b7-657a-4ca2-af6f-d1c33f6d2fff
85+
}
86+
IsSystemProtected : True
87+
```
88+
89+
### List deny assignments at a resource group scope
90+
91+
To list all deny assignments at a resource group scope, use [Get-AzDenyAssignment](/powershell/module/az.resources/get-azdenyassignment).
92+
93+
```azurepowershell
94+
Get-AzDenyAssignment -ResourceGroupName <resource_group_name>
95+
```
96+
97+
```Example
98+
PS C:\> Get-AzDenyAssignment -ResourceGroupName TestingBPLocks | FL DenyAssignmentName, Scope
99+
100+
DenyAssignmentName : Deny assignment '22222222-2222-2222-2222-222222222222' created by Blueprint Assignment
101+
'/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Blueprint/blueprintAssignments/assignment-locked-storageaccount-TestingBPLocks'.
102+
Scope : /subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/TestingBPLocks
103+
Principals : {
104+
DisplayName: All Principals
105+
ObjectType: SystemDefined
106+
ObjectId: 00000000-0000-0000-0000-000000000000
107+
}
108+
```
109+
110+
### List deny assignments at a subscription scope
111+
112+
To list all deny assignments at a subscription scope, use [Get-AzDenyAssignment](/powershell/module/az.resources/get-azdenyassignment). To get the subscription ID, you can find it on the **Subscriptions** blade in the Azure portal or you can use [Get-AzSubscription](/powershell/module/Az.Accounts/Get-AzSubscription).
113+
114+
```azurepowershell
115+
Get-AzDenyAssignment -Scope /subscriptions/<subscription_id>
116+
```
117+
118+
```Example
119+
PS C:\> Get-AzDenyAssignment -Scope /subscriptions/11111111-1111-1111-1111-111111111111
120+
```
121+
122+
## Next steps
123+
124+
- [Understand deny assignments for Azure resources](deny-assignments.md)
125+
- [List deny assignments for Azure resources using the Azure portal](deny-assignments-portal.md)
126+
- [List deny assignments for Azure resources using the REST API](deny-assignments-rest.md)

articles/role-based-access-control/deny-assignments-rest.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: List deny assignments for Azure resources using the REST API - Azure | Microsoft Docs
3-
description: Learn how to list deny assignments for users, groups, and applications, using role-based access control (RBAC) for Azure resources and the REST API.
3+
description: Learn how to list deny assignments for users, groups, and applications using role-based access control (RBAC) for Azure resources and the REST API.
44
services: active-directory
55
documentationcenter: na
66
author: rolyon
@@ -13,17 +13,17 @@ ms.workload: multiple
1313
ms.tgt_pltfrm: rest-api
1414
ms.devlang: na
1515
ms.topic: conceptual
16-
ms.date: 03/13/2019
16+
ms.date: 06/10/2019
1717
ms.author: rolyon
1818
ms.reviewer: bagovind
1919

2020
---
2121
# List deny assignments for Azure resources using the REST API
2222

23-
[Deny assignments](deny-assignments.md) block users from performing specific Azure resource actions even if a role assignment grants them access. This article describes how to use the REST API to list deny assignments.
23+
[Deny assignments](deny-assignments.md) block users from performing specific Azure resource actions even if a role assignment grants them access. This article describes how to list deny assignments using the REST API.
2424

2525
> [!NOTE]
26-
> At this time, the only way you can add your own deny assignments is by using Azure Blueprints. For more information, see [Protect new resources with Azure Blueprints resource locks](../governance/blueprints/tutorials/protect-new-resources.md).
26+
> You can't directly create your own deny assignments. For information about how deny assignments are created, see [Deny assignments](deny-assignments.md).
2727
2828
## Prerequisites
2929

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

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,34 @@ ms.devlang: na
1212
ms.topic: conceptual
1313
ms.tgt_pltfrm: na
1414
ms.workload: identity
15-
ms.date: 03/13/2019
15+
ms.date: 06/13/2019
1616
ms.author: rolyon
1717
ms.reviewer: bagovind
1818
ms.custom:
1919
---
2020
# Understand deny assignments for Azure resources
2121

22-
Similar to a role assignment, a *deny assignment* attaches a set of deny actions to a user, group, or service principal at a particular scope for the purpose of denying access. Deny assignments block users from performing specific Azure resource actions even if a role assignment grants them access. Some resource providers in Azure now include deny assignments.
23-
24-
In some ways, deny assignments are different than role assignments. Deny assignments can exclude principals and prevent inheritance to child scopes. Deny assignments also apply to [classic subscription administrator](rbac-and-directory-admin-roles.md) assignments.
22+
Similar to a role assignment, a *deny assignment* attaches a set of deny actions to a user, group, or service principal at a particular scope for the purpose of denying access. Deny assignments block users from performing specific Azure resource actions even if a role assignment grants them access.
2523

2624
This article describes how deny assignments are defined.
2725

28-
> [!NOTE]
29-
> At this time, the only way you can add your own deny assignments is by using Azure Blueprints. For more information, see [Protect new resources with Azure Blueprints resource locks](../governance/blueprints/tutorials/protect-new-resources.md).
26+
## How deny assignments are created
27+
28+
Deny assignments are created and managed by Azure to protect resources. For example, Azure Blueprints and Azure managed apps use deny assignments to protect system-managed resources. For more information, see [Protect new resources with Azure Blueprints resource locks](../governance/blueprints/tutorials/protect-new-resources.md).
29+
30+
## Compare role assignments and deny assignments
31+
32+
Deny assignments follow a similar pattern as deny assignments, but also have some differences.
33+
34+
| Capability | Role assignment | Deny assignment |
35+
| --- | --- | --- |
36+
| Grant access | :heavy_check_mark: | |
37+
| Deny access | | :heavy_check_mark: |
38+
| Can be directly created | :heavy_check_mark: | |
39+
| Apply at a scope | :heavy_check_mark: | :heavy_check_mark: |
40+
| Exclude principals | | :heavy_check_mark: |
41+
| Prevent inheritance to child scopes | | :heavy_check_mark: |
42+
| Apply to [classic subscription administrator](rbac-and-directory-admin-roles.md) assignments | | :heavy_check_mark: |
3043

3144
## Deny assignment properties
3245

@@ -49,14 +62,24 @@ This article describes how deny assignments are defined.
4962
> | `ExcludePrincipals[i].Type` | No | String[] | An array of object types represented by ExcludePrincipals[i].Id. |
5063
> | `IsSystemProtected` | No | Boolean | Specifies whether this deny assignment was created by Azure and cannot be edited or deleted. Currently, all deny assignments are system protected. |
5164
52-
## System-Defined Principal
65+
## The All Principals principal
66+
67+
To support deny assignments, a system-defined principal named *All Principals* has been introduced. This principal represents all users, groups, service principals, and managed identities in an Azure AD directory. If the principal ID is a zero GUID `00000000-0000-0000-0000-000000000000` and the principal type is `SystemDefined`, the principal represents all principals. In Azure PowerShell output, All Principals looks like the following:
68+
69+
```azurepowershell
70+
Principals : {
71+
DisplayName: All Principals
72+
ObjectType: SystemDefined
73+
ObjectId: 00000000-0000-0000-0000-000000000000
74+
}
75+
```
5376

54-
To support deny assignments, the **System-Defined Principal** has been introduced. This principal represents all users, groups, service principals, and managed identities in an Azure AD directory. If the principal ID is a zero GUID `00000000-0000-0000-0000-000000000000` and the principal type is `SystemDefined`, the principal represents all principals. `SystemDefined` can be combined with `ExcludePrincipals` to deny all principals except some users. `SystemDefined` has the following constraints:
77+
All Principals can be combined with `ExcludePrincipals` to deny all principals except some users. All Principals has the following constraints:
5578

5679
- Can be used only in `Principals` and cannot be used in `ExcludePrincipals`.
5780
- `Principals[i].Type` must be set to `SystemDefined`.
5881

5982
## Next steps
6083

61-
* [View deny assignments for Azure resources using the Azure portal](deny-assignments-portal.md)
84+
* [List deny assignments for Azure resources using the Azure portal](deny-assignments-portal.md)
6285
* [Understand role definitions for Azure resources](role-definitions.md)

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ms.devlang: na
1212
ms.topic: overview
1313
ms.tgt_pltfrm: na
1414
ms.workload: identity
15-
ms.date: 03/13/2019
15+
ms.date: 06/12/2019
1616
ms.author: rolyon
1717
ms.reviewer: bagovind
1818

@@ -106,10 +106,7 @@ So what happens if you have multiple overlapping role assignments? RBAC is an ad
106106

107107
## Deny assignments
108108

109-
Previously, RBAC was an allow-only model with no deny, but now RBAC supports deny assignments in a limited way. Similar to a role assignment, a *deny assignment* attaches a set of deny actions to a user, group, service principal, or managed identity at a particular scope for the purpose of denying access. A role assignment defines a set of actions that are *allowed*, while a deny assignment defines a set of actions that are *not allowed*. In other words, deny assignments block users from performing specified actions even if a role assignment grants them access. Deny assignments take precedence over role assignments. For more information, see [Understand deny assignments for Azure resources](deny-assignments.md) and [View deny assignments for Azure resources using the Azure portal](deny-assignments-portal.md).
110-
111-
> [!NOTE]
112-
> At this time, the only way you can add your own deny assignments is by using Azure Blueprints. For more information, see [Protect new resources with Azure Blueprints resource locks](../governance/blueprints/tutorials/protect-new-resources.md).
109+
Previously, RBAC was an allow-only model with no deny, but now RBAC supports deny assignments in a limited way. Similar to a role assignment, a *deny assignment* attaches a set of deny actions to a user, group, service principal, or managed identity at a particular scope for the purpose of denying access. A role assignment defines a set of actions that are *allowed*, while a deny assignment defines a set of actions that are *not allowed*. In other words, deny assignments block users from performing specified actions even if a role assignment grants them access. Deny assignments take precedence over role assignments. For more information, see [Understand deny assignments for Azure resources](deny-assignments.md).
113110

114111
## How RBAC determines if a user has access to a resource
115112

0 commit comments

Comments
 (0)