Skip to content

Commit 073fcbe

Browse files
committed
Configure permission classifications with Microsoft Graph
1 parent 6f18d6f commit 073fcbe

File tree

1 file changed

+134
-12
lines changed

1 file changed

+134
-12
lines changed

articles/active-directory/manage-apps/configure-permission-classifications.md

Lines changed: 134 additions & 12 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: 10/23/2021
11+
ms.date: 2/23/2023
1212
ms.author: jomondi
1313
ms.reviewer: arvindh, luleon, phsignor, jawoods
1414
ms.custom: contperf-fy21q2
15+
zone_pivot_groups: enterprise-apps-all
1516

1617
#customer intent: As an admin, I want configure permission classifications for applications in Azure AD
1718
---
@@ -29,11 +30,11 @@ The minimum permissions needed to do basic sign in are `openid`, `profile`, `ema
2930
To configure permission classifications, you need:
3031

3132
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
32-
- One of the following roles: Global Administrator, Cloud Application Administrator, Application Administrator, or owner of the service principal.
33+
- One of the following roles: An administrator, or owner of the service principal.
3334

3435
## Manage permission classifications
3536

36-
# [Portal](#tab/azure-portal)
37+
:::zone pivot="portal"
3738

3839
Follow these steps to classify permissions using the Azure portal:
3940

@@ -46,11 +47,20 @@ In this example, we've classified the minimum set of permission required for sin
4647

4748
:::image type="content" source="media/configure-permission-classifications/permission-classifications.png" alt-text="Permission classifications":::
4849

49-
# [PowerShell](#tab/azure-powershell)
5050

51-
You can use the latest Azure AD PowerShell Preview module, [AzureADPreview](/powershell/module/azuread/?preserve-view=true&view=azureadps-2.0-preview), to classify permissions. Permission classifications are configured on the **ServicePrincipal** object of the API that publishes the permissions.
51+
:::zone-end
5252

53-
#### List the current permission classifications for an API
53+
:::zone pivot="aad-powershell"
54+
55+
You can use the latest [Azure AD PowerShell](/powershell/module/azuread/?view=azureadps-2.0), to classify permissions. Permission classifications are configured on the **ServicePrincipal** object of the API that publishes the permissions.
56+
57+
Run the following command to connect to Azure AD PowerShell. To consent to the required scopes, sign in with one of the roles listed in the prerequisite section of this article.
58+
59+
```powershell
60+
Connect-AzureAD -Scopes "Application.ReadWrite.All", "Directory.ReadWrite.All", "DelegatedPermissionGrant.ReadWrite.All".
61+
```
62+
63+
### List the current permission classifications
5464

5565
1. Retrieve the **ServicePrincipal** object for the API. Here we retrieve the ServicePrincipal object for the Microsoft Graph API:
5666

@@ -66,7 +76,7 @@ You can use the latest Azure AD PowerShell Preview module, [AzureADPreview](/pow
6676
-ServicePrincipalId $api.ObjectId | Format-Table Id, PermissionName, Classification
6777
```
6878

69-
#### Classify a permission as "Low impact"
79+
### Classify a permission as "Low impact"
7080

7181
1. Retrieve the **ServicePrincipal** object for the API. Here we retrieve the ServicePrincipal object for the Microsoft Graph API:
7282

@@ -91,7 +101,7 @@ You can use the latest Azure AD PowerShell Preview module, [AzureADPreview](/pow
91101
-Classification "low"
92102
```
93103

94-
#### Remove a delegated permission classification
104+
### Remove a delegated permission classification
95105

96106
1. Retrieve the **ServicePrincipal** object for the API. Here we retrieve the ServicePrincipal object for the Microsoft Graph API:
97107

@@ -115,11 +125,123 @@ You can use the latest Azure AD PowerShell Preview module, [AzureADPreview](/pow
115125
-ServicePrincipalId $api.ObjectId `
116126
-Id $classificationToRemove.Id
117127
```
128+
:::zone-end
118129

119-
---
130+
:::zone pivot="ms-powershell"
120131

121-
## Next steps
132+
You can use Microsoft Graph PowerShell](/powershell/microsoftgraph/get-started?view=graph-powershell-1.0), to classify permissions. Permission classifications are configured on the **ServicePrincipal** object of the API that publishes the permissions.
133+
134+
Run the following command to connect to Microsoft Graph PowerShell. To consent to the required scopes, sign in with one of the roles listed in the prerequisite section of this article.
135+
136+
```powershell
137+
Connect-MgGraph -Scopes "Application.ReadWrite.All", "Directory.ReadWrite.All", "DelegatedPermissionGrant.ReadWrite.All".
138+
```
139+
140+
### List current permission classifications for an API
141+
142+
1. Retrieve the servicePrincipal object for the API
143+
144+
```powershell
145+
$api = Get-MgServicePrincipal -Filter "displayName eq 'Microsoft Graph'"
146+
```
147+
148+
1. Read the delegated permission classifications for the API
149+
150+
```powershell
151+
Get-MgServicePrincipalDelegatedPermissionClassification -ServicePrincipalId $api.Id
152+
```
153+
154+
### Classify a permission as "Low impact"
155+
156+
1. Retrieve the servicePrincipal object for the API
157+
158+
```powershell
159+
$api = Get-MgServicePrincipal -Filter "displayName eq 'Microsoft Graph'"
160+
```
161+
162+
1. Find the delegated permission you would like to classify
163+
164+
```powershell
165+
$delegatedPermission = $api.Oauth2PermissionScopes | Where-Object {$_.Value -eq "openid"}
166+
```
167+
168+
1. Set the permission classification
169+
170+
```powershell
171+
$params = @{
172+
173+
PermissionId = $delegatedPermission.Id
174+
175+
PermissionName = $delegatedPermission.Value
176+
177+
Classification = "Low"
122178
123-
To learn more:
179+
}
180+
181+
New-MgServicePrincipalDelegatedPermissionClassification -ServicePrincipalId $api.Id -BodyParameter $params
182+
```
183+
184+
### Remove a delegated permission classification
185+
186+
1. Retrieve the servicePrincipal object for the API
187+
188+
```powershell
189+
$api = Get-MgServicePrincipal -Filter "displayName eq 'Microsoft Graph'"
190+
```
191+
192+
1. Find the delegated permission classification you wish to remove
193+
194+
```powershell
195+
$classifications= Get-MgServicePrincipalDelegatedPermissionClassification -ServicePrincipalId $api.Id
196+
197+
$classificationToRemove = $classifications | Where-Object {$_.PermissionName -eq "openid"}
198+
```
199+
200+
1. Delete the permission classification
201+
202+
```powershell
203+
Remove-MgServicePrincipalDelegatedPermissionClassification -DelegatedPermissionClassificationId $classificationToRemove.Id -ServicePrincipalId $api.id
204+
```
205+
:::zone-end
206+
207+
:::zone pivot="ms-graph
208+
209+
To configure permissions classifications for an enterprise application, sign in to [Graph Explorer](https://developer.microsoft.com/graph/graph-explorer) with one of the roles listed in the prerequisite section.
210+
211+
You'll need to consent to the following permissions:
212+
213+
`Application.ReadWrite.All`, `Directory.ReadWrite.All`, `DelegatedPermissionGrant.ReadWrite.All`.
214+
215+
Run the following queries on Microsoft Graph explorer to add a delegated permissions classification for an application.
216+
217+
1. List current permission classifications for an API
218+
219+
```http
220+
GET https://graph.microsoft.com/v1.0/servicePrincipals(appId='00000003-0000-0000-c000-000000000000')/delegatedPermissionClassifications
221+
```
222+
223+
1. Add a delegated permission classification for an application. In the following example, we'll classify the permission as "low impact".
224+
225+
```http
226+
POST https://graph.microsoft.com/v1.0/servicePrincipals(appId='00000003-0000-0000-c000-000000000000')/delegatedPermissionClassifications
227+
Content-type: application/json
228+
229+
{
230+
"permissionId": "b4e74841-8e56-480b-be8b-910348b18b4c",
231+
"classification": "low"
232+
}
233+
```
234+
235+
Run the following query on Microsoft Graph explorer to remove a delegated permissions classification for an application.
236+
237+
```http
238+
DELETE https://graph.microsoft.com/v1.0/servicePrincipals(appId='00000003-0000-0000-c000-000000000000')/delegatedPermissionClassifications/QUjntFaOC0i-i5EDSLGLTAE
239+
```
240+
241+
:::zone-end
242+
243+
244+
## Next steps
124245

125-
- Go to [Permissions and consent in the Microsoft identity platform](../develop/v2-permissions-and-consent.md)
246+
- [Manage app consent policies](manage-app-consent-policies.md)
247+
- [Permissions and consent in the Microsoft identity platform](../develop/v2-permissions-and-consent.md)

0 commit comments

Comments
 (0)