Skip to content

Commit 0901050

Browse files
committed
more updates
1 parent d56b650 commit 0901050

File tree

1 file changed

+24
-41
lines changed

1 file changed

+24
-41
lines changed

articles/active-directory/manage-apps/grant-admin-consent.md

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.service: active-directory
88
ms.subservice: app-mgmt
99
ms.workload: identity
1010
ms.topic: how-to
11-
ms.date: 11/03/2022
11+
ms.date: 11/07/2022
1212
ms.author: ergreenl
1313
ms.collection: M365-identity-device-management
1414
ms.custom: contperf-fy22q2
@@ -21,12 +21,10 @@ zone_pivot_groups: enterprise-apps-minus-aad-powershell
2121

2222
In this article, you'll learn how to grant tenant-wide admin consent to an application in Azure Active Directory (Azure AD). To understand how individual users consent, see [Configure how end-users consent to applications](configure-user-consent.md).
2323

24-
When you grant tenant-wide admin consent to an application, you give the application access on behalf of the whole organization to the permissions requested. Granting admin consent on behalf of an organization is a sensitive operation, potentially allowing the application's publisher access to significant portions of your organization's data, or the permission to do highly privileged operations. Examples of such operations might be role management, full access to all mailboxes or all sites, and full user impersonation.
24+
When you grant tenant-wide admin consent to an application, you give the application access on behalf of the whole organization to the permissions requested. Granting admin consent on behalf of an organization is a sensitive operation, potentially allowing the application's publisher access to significant portions of your organization's data, or the permission to do highly privileged operations. Examples of such operations might be role management, full access to all mailboxes or all sites, and full user impersonation. Carefully review the permissions that the application is requesting before you grant consent.
2525

2626
By default, granting tenant-wide admin consent to an application will allow all users to access the application unless otherwise restricted. To restrict which users can sign-in to an application, configure the app to [require user assignment](application-properties.md#assignment-required) and then [assign users or groups to the application](assign-user-or-group-access-portal.md).
2727

28-
Tenant-wide admin consent to an app grants the app and the app's publisher access to your organization's data. Carefully review the permissions that the application is requesting before you grant consent. For more information on consenting to applications, see [Azure Active Directory consent framework](../develop/consent-framework.md).
29-
3028
Granting tenant-wide admin consent may revoke any permissions which had previously been granted tenant-wide for that application. Permissions which have previously been granted by users on their own behalf will not be affected.
3129

3230
## Prerequisites
@@ -90,40 +88,36 @@ As always, carefully review the permissions an application requests before grant
9088

9189
:::zone pivot="ms-powershell"
9290

93-
In the following example, the application is Microsoft Graph. The object ID of Microsoft Graph in the tenant is b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94. The delegated permissions `User.Read.All` and `Group.Read.All` are identified by the globally unique IDs `a154be20-db9c-4678-8ab7-66f6cc099a59` and `5f8c59db-677d-491f-a6b8-5f174b11ec1d respectively`. The consentType is AllPrincipals, indicating that you're consenting on behalf of all users in the tenant.
91+
In the following example, you'll grant delegated permissions defined by a resource enterprise application to a client enterprise application on behalf of all users.
92+
93+
In the example, the resource enterprise application is Microsoft Graph of object ID `7ea9e944-71ce-443d-811c-71e8047b557a`. The Microsoft Graph defines the delegated permissions `User.Read.All` and `Group.Read.All`. The consentType is AllPrincipals, indicating that you're consenting on behalf of all users in the tenant. The object ID of the client enterprise application is `b0d9b9e3-0ecf-4bfd-8dab-9273dd055a941`.
9494

9595
> [!CAUTION]
9696
> Be careful! Permissions granted programmatically are not subject to review or confirmation. They take effect immediately.
9797
9898
## Grant admin consent for delegated permissions
9999

100-
1. 1. Connect to Microsoft Graph PowerShell:
101-
102-
```powershell
103-
Connect-MgGraph -Scopes "Application.ReadWrite.All", "DelegatedPermissionGrant.ReadWrite.All", "AppRoleAssignment.ReadWrite.All"
104-
```
105-
106-
1. Get the enterprise application to which you want to grant delegated permissions.
100+
1. Connect to Microsoft Graph PowerShell:
107101

108102
```powershell
109-
Get-MgServicePrincipal -servicePrincipalId b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94
103+
Connect-MgGraph -Scopes "Application.ReadWrite.All", "DelegatedPermissionGrant.ReadWrite.All"
110104
```
111105

112-
1. Retrieve the delegated permissions defined by Microsoft graph in your tenant application.
106+
1. Retrieve all the delegated permissions defined by Microsoft graph (the resource application) in your tenant application. Identify the delegated permissions that you'll grant the client application. In this example, the delegation permissions are `User.Read.All` and `Group.Read.All`
113107

114108
```powershell
115109
Get-MgServicePrincipal -Filter "displayName eq 'Microsoft Graph'" -Property Oauth2PermissionScopes | Select -ExpandProperty Oauth2PermissionScopes | fl
116110
```
117111

118-
1. Carefully review the permissions that the application requires. If you agree with the list of permissions, grant the delegated permissions to the application by running the following request.
112+
1. Grant the delegated permissions to the client enterprise application by running the following request.
119113

120114
```powershell
121115
$params = @{
122116
123117
"ClientId" = "b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94"
124118
"ConsentType" = "AllPrincipals"
125-
"ResourceId" = "2cab1707-656d-40cc-8522-3178a184e03d"
126-
"Scope" = "Group.Read.All"
119+
"ResourceId" = "7ea9e944-71ce-443d-811c-71e8047b557a"
120+
"Scope" = "User.Read.All Group.Read.All"
127121
}
128122
129123
New-MgOauth2PermissionGrant -BodyParameter $params |
@@ -137,23 +131,21 @@ New-MgOauth2PermissionGrant -BodyParameter $params |
137131
```
138132
## Grant admin consent for application permissions
139133

140-
In the following example you grant the Microsoft Graph application (the principal of ID `b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94`) an app role (application permission) of ID `df021288-bdef-4463-88db-98f22de89214` that's exposed by a resource API of ID `7ea9e944-71ce-443d-811c-71e8047b557a`.
141-
142-
1. Get the object ID of the enterprise application to which you'll grant application permissions. In the following example, the application is Microsoft Graph, identified by ID `b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94`.
134+
In the following example you grant the Microsoft Graph enterprise application (the principal of ID `b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94`) an app role (application permission) of ID `df021288-bdef-4463-88db-98f22de89214` that's exposed by a resource enterprise application of ID `7ea9e944-71ce-443d-811c-71e8047b557a`.
143135

144-
1. Get the enterprise application to which you want to grant delegated permissions.
136+
1. Connect to Microsoft Graph PowerShell:
145137

146138
```powershell
147-
Get-MgServicePrincipal -servicePrincipalId b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94
139+
Connect-MgGraph -Scopes "Application.ReadWrite.All", "AppRoleAssignment.ReadWrite.All"
148140
```
149141

150-
1. Retrieve the application permissions defined by Microsoft graph in your tenant application.
142+
1. Retrieve the app roles defined by Microsoft graph in your tenant. Identify the app role that you'll grant the client enterprise application. In this example, the app role ID is `df021288-bdef-4463-88db-98f22de89214`.
151143

152144
```powershell
153145
Get-MgServicePrincipal -Filter "displayName eq 'Microsoft Graph'" -Property AppRoles | Select -ExpandProperty appRoles |fl
154146
```
155147

156-
1. Carefully review the permissions that the application requires. If you agree with the list of permissions, grant the application permissions to the application by running the following request.
148+
1. Grant the application permission (app role) to the client enterprise application by running the following request.
157149

158150
```powershell
159151
$params = @{
@@ -174,24 +166,20 @@ Use [Graph Explorer](https://developer.microsoft.com/graph/graph-explorer) to gr
174166

175167
## Grant admin consent for delegated permissions
176168

177-
In the following example, the application is Microsoft Graph. The object ID of Microsoft Graph in the tenant is b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94. The delegated permissions `User.Read.All` and `Group.Read.All` are identified by the globally unique IDs `a154be20-db9c-4678-8ab7-66f6cc099a59` and `5f8c59db-677d-491f-a6b8-5f174b11ec1d respectively`. The consentType is AllPrincipals, indicating that you're consenting on behalf of all users in the tenant.
169+
In the following example, you'll grant delegated permissions defined by a resource enterprise application to a client enterprise application on behalf of all users.
170+
171+
In the example, the resource enterprise application is Microsoft Graph of object ID `7ea9e944-71ce-443d-811c-71e8047b557a`. The Microsoft Graph defines the delegated permissions `User.Read.All` and `Group.Read.All`. The consentType is AllPrincipals, indicating that you're consenting on behalf of all users in the tenant. The object ID of the client enterprise application is `b0d9b9e3-0ecf-4bfd-8dab-9273dd055a941`.
178172

179173
> [!CAUTION]
180174
> Be careful! Permissions granted programmatically are not subject to review or confirmation. They take effect immediately.
181175
182-
1. Get the object ID of the enterprise application to which you'll grant application permissions. In the following example, the application is Microsoft Graph, identified by ID `b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94`.
183-
184-
```http
185-
GET /servicePrincipals/b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94
186-
```
187-
188-
1. Retrieve the delegated permissions defined by Microsoft graph in your tenant application.
176+
1. Retrieve all the delegated permissions defined by Microsoft graph (the resource application) in your tenant application. Identify the delegated permissions that you'll grant the client application. In this example, the delegation permissions are `User.Read.All` and `Group.Read.All`
189177

190178
```http
191179
GET https://graph.microsoft.com/v1.0/servicePrincipals?$filter=displayName eq 'Microsoft Graph'&$select=id,displayName,appId,oauth2PermissionScopes
192180
```
193181

194-
1. Carefully review the permissions that the application requires. If you agree with the list of permissions, grant the delegated permissions to the application by running the following request.
182+
1. Grant the delegated permissions to the client enterprise application by running the following request.
195183

196184
```http
197185
POST https://graph.microsoft.com/v1.0/oauth2PermissionGrants
@@ -211,19 +199,14 @@ In the following example, the application is Microsoft Graph. The object ID of M
211199
```
212200
## Grant admin consent for application permissions
213201

214-
In the following example you grant the Microsoft Graph application (the principal of ID `b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94`) an app role (application permission) of ID `df021288-bdef-4463-88db-98f22de89214` that's exposed by a resource API of ID `7ea9e944-71ce-443d-811c-71e8047b557a`.
215-
216-
1. Get the object ID of the enterprise application to which you'll grant application permissions. In the following example, the application is Microsoft Graph, identified by ID `b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94`.
202+
In the following example you grant the Microsoft Graph enterprise application (the principal of ID `b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94`) an app role (application permission) of ID `df021288-bdef-4463-88db-98f22de89214` that's exposed by a resource enterprise application of ID `7ea9e944-71ce-443d-811c-71e8047b557a`.
217203

218-
```http
219-
GET /servicePrincipals/b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94
220-
```
221-
1. Retrieve the application permissions defined by Microsoft graph in your tenant application.
204+
1. Retrieve the app roles defined by Microsoft graph in your tenant. Identify the app role that you'll grant the client enterprise application. In this example, the app role ID is `df021288-bdef-4463-88db-98f22de89214`
222205

223206
```http
224207
GET https://graph.microsoft.com/v1.0/servicePrincipals?$filter=displayName eq 'Microsoft Graph'&$select=id,displayName,appId,appRoles
225208
```
226-
1. Carefully review the permissions that the application requires. If you agree with the list of permissions, grant the application permissions to the application by running the following request.
209+
1. Grant the application permission (app role) to the client enterprise application by running the following request.
227210

228211
```http
229212
POST https://graph.microsoft.com/v1.0/servicePrincipals/7ea9e944-71ce-443d-811c-71e8047b557a/appRoleAssignedTo

0 commit comments

Comments
 (0)