Skip to content

Commit 32b412b

Browse files
authored
Merge pull request #225168 from omondiatieno/consent-policy-update
manage app consent policies with Microsoft Graph
2 parents 0140c5d + 34d9ab8 commit 32b412b

File tree

2 files changed

+112
-13
lines changed

2 files changed

+112
-13
lines changed

articles/active-directory/manage-apps/manage-app-consent-policies.md

Lines changed: 103 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ ms.service: active-directory
88
ms.subservice: app-mgmt
99
ms.workload: identity
1010
ms.topic: how-to
11-
ms.date: 09/02/2021
11+
ms.date: 01/26/2023
1212
ms.author: jomondi
1313
ms.reviewer: phsignor, yuhko
1414
ms.custom: contperf-fy21q2
15+
zone_pivot_groups: enterprise-apps-minus-portal-aad
1516

1617
#customer intent: As an admin, I want to manage app consent policies for enterprise applications in Azure AD
1718
---
@@ -24,16 +25,18 @@ An app consent policy consists of one or more "include" condition sets and zero
2425

2526
Each condition set consists of several conditions. For an event to match a condition set, *all* conditions in the condition set must be met.
2627

27-
App consent policies where the ID begins with "microsoft-" are built-in policies. Some of these built-in policies are used in existing built-in directory roles. For example, the `microsoft-application-admin` app consent policy describes the conditions under which the Application Administrator and Cloud Application Administrator roles are allowed to grant tenant-wide admin consent. Built-in policies can be used in custom directory roles and to configure user consent settings, but cannot be edited or deleted.
28+
App consent policies where the ID begins with "microsoft-" are built-in policies. Some of these built-in policies are used in existing built-in directory roles. For example, the `microsoft-application-admin` app consent policy describes the conditions under which the Application Administrator and Cloud Application Administrator roles are allowed to grant tenant-wide admin consent. Built-in policies can be used in custom directory roles and to configure user consent settings, but can't be edited or deleted.
2829

2930
## Pre-requisites
3031

31-
1. A user or service with one of the following:
32+
1. A user or service with one of the following roles:
3233
- Global Administrator directory role
3334
- Privileged Role Administrator directory role
3435
- A custom directory role with the necessary [permissions to manage app consent policies](../roles/custom-consent-permissions.md#managing-app-consent-policies)
3536
- The Microsoft Graph app role (application permission) Policy.ReadWrite.PermissionGrant (when connecting as an app or a service)
36-
37+
38+
:::zone pivot="ms-powershell"
39+
3740
1. Connect to [Microsoft Graph PowerShell](/powershell/microsoftgraph/get-started?view=graph-powershell-1.0&preserve-view=true).
3841

3942
```powershell
@@ -86,7 +89,7 @@ Follow these steps to create a custom app consent policy:
8689
-ClientApplicationsFromVerifiedPublisherOnly
8790
```
8891

89-
Repeat this step to add additional "include" condition sets.
92+
Repeat this step to add more "include" condition sets.
9093

9194
1. Optionally, add "exclude" condition sets.
9295

@@ -101,7 +104,7 @@ Follow these steps to create a custom app consent policy:
101104
-ResourceApplication $azureApi.AppId
102105
```
103106

104-
Repeat this step to add additional "exclude" condition sets.
107+
Repeat this step to add more "exclude" condition sets.
105108

106109
Once the app consent policy has been created, you can [allow user consent](configure-user-consent.md?tabs=azure-powershell#allow-user-consent-subject-to-an-app-consent-policy) subject to this policy.
107110

@@ -113,26 +116,113 @@ Once the app consent policy has been created, you can [allow user consent](confi
113116
Remove-MgPolicyPermissionGrantPolicy -PermissionGrantPolicyId "my-custom-policy"
114117
```
115118

116-
> [!WARNING]
117-
> Deleted app consent policies cannot be restored. If you accidentally delete a custom app consent policy, you will need to re-create the policy.
119+
:::zone-end
118120

119-
---
121+
:::zone pivot="ms-graph"
122+
123+
To manage app consent policies, sign in to [Graph Explorer](https://developer.microsoft.com/graph/graph-explorer) with one of the roles listed in the prerequisite section.
124+
125+
## List existing app consent policies
126+
127+
It's a good idea to start by getting familiar with the existing app consent policies in your organization:
128+
129+
1. List all app consent policies:
130+
131+
```http
132+
GET /policies/permissionGrantPolicies?$select=id,displayName,description
133+
```
134+
135+
1. View the "include" condition sets of a policy:
136+
137+
```http
138+
GET /policies/permissionGrantPolicies/{ microsoft-application-admin }/includes
139+
```
140+
141+
1. View the "exclude" condition sets:
142+
143+
```http
144+
GET /policies/permissionGrantPolicies/{ microsoft-application-admin }/excludes
145+
```
146+
147+
## Create a custom app consent policy
148+
149+
Follow these steps to create a custom app consent policy:
150+
151+
1. Create a new empty app consent policy.
120152

153+
```http
154+
POST https://graph.microsoft.com/v1.0/policies/permissionGrantPolicies
155+
Content-Type: application/json
156+
157+
{
158+
"id": "my-custom-policy",
159+
"displayName": "My first custom consent policy",
160+
"description": "This is a sample custom app consent policy"
161+
}
162+
```
163+
164+
1. Add "include" condition sets.
165+
166+
Include delegated permissions classified "low", for apps from verified publishers
167+
168+
```http
169+
POST https://graph.microsoft.com/v1.0/policies/permissionGrantPolicies/{ my-custom-policy }/includes
170+
Content-Type: application/json
171+
172+
{
173+
"permissionType": "delegated",
174+
“PermissionClassification: "low",
175+
"clientApplicationsFromVerifiedPublisherOnly": true
176+
}
177+
```
178+
179+
Repeat this step to add more "include" condition sets.
180+
181+
1. Optionally, add "exclude" condition sets.
182+
Exclude delegated permissions for the Azure Management API (appId 46e6adf4-a9cf-4b60-9390-0ba6fb00bf6b)
183+
```http
184+
POST https://graph.microsoft.com/v1.0/policies/permissionGrantPolicies/my-custom-policy /excludes
185+
Content-Type: application/json
186+
187+
{
188+
"permissionType": "delegated",
189+
"resourceApplication": "46e6adf4-a9cf-4b60-9390-0ba6fb00bf6b "
190+
}
191+
```
192+
193+
Repeat this step to add more "exclude" condition sets.
194+
195+
Once the app consent policy has been created, you can [allow user consent](configure-user-consent.md?tabs=azure-powershell#allow-user-consent-subject-to-an-app-consent-policy) subject to this policy.
196+
197+
## Delete a custom app consent policy
198+
199+
1. The following shows how you can delete a custom app consent policy. **This action can’t be undone.**
200+
201+
```http
202+
DELETE https://graph.microsoft.com/v1.0/policies/permissionGrantPolicies/ my-custom-policy
203+
```
204+
205+
:::zone-end
206+
207+
> [!WARNING]
208+
> Deleted app consent policies cannot be restored. If you accidentally delete a custom app consent policy, you will need to re-create the policy.
121209
### Supported conditions
122210

123211
The following table provides the list of supported conditions for app consent policies.
124212

125213
| Condition | Description|
126214
|:---------------|:----------|
127-
| PermissionClassification | The [permission classification](configure-permission-classifications.md) for the permission being granted, or "all" to match with any permission classification (including permissions which are not classified). Default is "all". |
128-
| PermissionType | The permission type of the permission being granted. Use "application" for application permissions (e.g. app roles) or "delegated" for delegated permissions. <br><br>**Note**: The value "delegatedUserConsentable" indicates delegated permissions which have not been configured by the API publisher to require admin consent—this value may be used in built-in permission grant policies, but cannot be used in custom permission grant policies. Required. |
129-
| ResourceApplication | The **AppId** of the resource application (e.g. the API) for which a permission is being granted, or "any" to match with any resource application or API. Default is "any". |
215+
| PermissionClassification | The [permission classification](configure-permission-classifications.md) for the permission being granted, or "all" to match with any permission classification (including permissions that aren't classified). Default is "all". |
216+
| PermissionType | The permission type of the permission being granted. Use "application" for application permissions (for example, app roles) or "delegated" for delegated permissions. <br><br>**Note**: The value "delegatedUserConsentable" indicates delegated permissions that haven't been configured by the API publisher to require admin consent. This value may be used in built-in permission grant policies, but can't be used in custom permission grant policies. Required. |
217+
| ResourceApplication | The **AppId** of the resource application (for example, the API) for which a permission is being granted, or "any" to match with any resource application or API. Default is "any". |
130218
| Permissions | The list of permission IDs for the specific permissions to match with, or a list with the single value "all" to match with any permission. Default is the single value "all". <ul><li>Delegated permission IDs can be found in the **OAuth2Permissions** property of the API's ServicePrincipal object.</li><li>Application permission IDs can be found in the **AppRoles** property of the API's ServicePrincipal object.</li></ol> |
131219
| ClientApplicationIds | A list of **AppId** values for the client applications to match with, or a list with the single value "all" to match any client application. Default is the single value "all". |
132220
| ClientApplicationTenantIds | A list of Azure Active Directory tenant IDs in which the client application is registered, or a list with the single value "all" to match with client apps registered in any tenant. Default is the single value "all". |
133221
| ClientApplicationPublisherIds | A list of Microsoft Partner Network (MPN) IDs for [verified publishers](../develop/publisher-verification-overview.md) of the client application, or a list with the single value "all" to match with client apps from any publisher. Default is the single value "all". |
134-
| ClientApplicationsFromVerifiedPublisherOnly | Set this switch to only match on client applications with a [verified publishers](../develop/publisher-verification-overview.md). Disable this switch (`-ClientApplicationsFromVerifiedPublisherOnly:$false`) to match on any client app, even if it does not have a verified publisher. Default is `$false`. |
222+
| ClientApplicationsFromVerifiedPublisherOnly | Set this switch to only match on client applications with a [verified publishers](../develop/publisher-verification-overview.md). Disable this switch (`-ClientApplicationsFromVerifiedPublisherOnly:$false`) to match on any client app, even if it doesn't have a verified publisher. Default is `$false`. |
135223

224+
> [!WARNING]
225+
> Deleted app consent policies cannot be restored. If you accidentally delete a custom app consent policy, you will need to re-create the policy.
136226
## Next steps
137227

138228
To learn more:

articles/zone-pivot-groups.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,6 +1847,15 @@ groups:
18471847
title: Microsoft Graph PowerShell
18481848
- id: ms-graph
18491849
title: Microsoft Graph
1850+
## Template without portal and Azure AD Graph
1851+
- id: enterprise-apps-minus-portal-aad
1852+
title: Manage Enterprise apps
1853+
prompt: Choose an option
1854+
pivots:
1855+
- id: ms-powershell
1856+
title: Microsoft Graph PowerShell
1857+
- id: ms-graph
1858+
title: Microsoft Graph
18501859
## template without graph
18511860
- id: enterprise-apps-minus-graph
18521861
title: Manage Enterprise apps

0 commit comments

Comments
 (0)