Skip to content

Commit d56b650

Browse files
committed
minor fix
1 parent b493739 commit d56b650

File tree

1 file changed

+30
-22
lines changed

1 file changed

+30
-22
lines changed

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

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,20 @@ In the following example, the application is Microsoft Graph. The object ID of M
105105

106106
1. Get the enterprise application to which you want to grant delegated permissions.
107107

108-
Get-MgServicePrincipal -servicePrincipalId b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94
108+
```powershell
109+
Get-MgServicePrincipal -servicePrincipalId b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94
110+
```
109111

110112
1. Retrieve the delegated permissions defined by Microsoft graph in your tenant application.
111113

112-
113-
Get-MgServicePrincipal -Filter "displayName eq 'Microsoft Graph'" -Property Oauth2PermissionScopes | Select -ExpandProperty Oauth2PermissionScopes | fl
114-
114+
```powershell
115+
Get-MgServicePrincipal -Filter "displayName eq 'Microsoft Graph'" -Property Oauth2PermissionScopes | Select -ExpandProperty Oauth2PermissionScopes | fl
116+
```
115117

116118
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.
117119

118-
119-
$params = @{
120+
```powershell
121+
$params = @{
120122
121123
"ClientId" = "b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94"
122124
"ConsentType" = "AllPrincipals"
@@ -126,37 +128,43 @@ Get-MgServicePrincipal -Filter "displayName eq 'Microsoft Graph'" -Property Oaut
126128
127129
New-MgOauth2PermissionGrant -BodyParameter $params |
128130
Format-List Id, ClientId, ConsentType, ResourceId, Scope
129-
130-
131+
```
132+
131133
1. Confirm that you've granted tenant wide admin consent by running the following request.
132134

133-
135+
```powershell
134136
Get-MgOauth2PermissionGrant-Filter "clientId eq 'b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94' consentType eq 'AllPrincipals'"
135-
137+
```
136138
## Grant admin consent for application permissions
137139

138-
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.
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`.
139141

140-
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.
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`.
141143

142-
1. Get the enterprise application to which you want to grant delegated permissions.
144+
1. Get the enterprise application to which you want to grant delegated permissions.
143145

144-
Get-MgServicePrincipal -servicePrincipalId b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94
146+
```powershell
147+
Get-MgServicePrincipal -servicePrincipalId b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94
148+
```
145149

146150
1. Retrieve the application permissions defined by Microsoft graph in your tenant application.
147151

148-
Get-MgServicePrincipal -Filter "displayName eq 'Microsoft Graph'" -Property AppRoles | Select -ExpandProperty appRoles |fl
152+
```powershell
153+
Get-MgServicePrincipal -Filter "displayName eq 'Microsoft Graph'" -Property AppRoles | Select -ExpandProperty appRoles |fl
154+
```
149155

150156
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.
151157

152-
$params = @{
158+
```powershell
159+
$params = @{
153160
"PrincipalId" ="b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94"
154161
"ResourceId" = "2cab1707-656d-40cc-8522-3178a184e03d"
155162
"AppRoleId" = "df021288-bdef-4463-88db-98f22de89214"
156163
}
157164
158165
New-MgServicePrincipalAppRoleAssignment -ServicePrincipalId '2cab1707-656d-40cc-8522-3178a184e03d' -BodyParameter $params |
159166
Format-List Id, AppRoleId, CreatedDateTime, PrincipalDisplayName, PrincipalId, PrincipalType, ResourceDisplayName
167+
```
160168

161169
:::zone-end
162170

@@ -171,11 +179,11 @@ In the following example, the application is Microsoft Graph. The object ID of M
171179
> [!CAUTION]
172180
> Be careful! Permissions granted programmatically are not subject to review or confirmation. They take effect immediately.
173181
174-
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.
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`.
175183

176-
```http
177-
GET /servicePrincipals/b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94
178-
```
184+
```http
185+
GET /servicePrincipals/b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94
186+
```
179187

180188
1. Retrieve the delegated permissions defined by Microsoft graph in your tenant application.
181189

@@ -203,9 +211,9 @@ GET /servicePrincipals/b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94
203211
```
204212
## Grant admin consent for application permissions
205213

206-
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.
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`.
207215

208-
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.
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`.
209217

210218
```http
211219
GET /servicePrincipals/b0d9b9e3-0ecf-4bfd-8dab-9273dd055a94

0 commit comments

Comments
 (0)