Skip to content

Commit 46a7284

Browse files
committed
📜 add docs for granting permission to apps defined in other AAD tenants
1 parent 1609e86 commit 46a7284

File tree

2 files changed

+58
-15
lines changed

2 files changed

+58
-15
lines changed

docs/spfx/release-1.15.2.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: SharePoint Framework v1.15.2 release notes
33
description: Release notes for the SharePoint Framework v1.15.2 release
4-
ms.date: 08/09/2022
4+
ms.date: 06/27/2022
55
ms.localizationpriority: high
66
---
77
# SharePoint Framework v1.15.2 release notes
@@ -48,7 +48,9 @@ Previously it was assumed and required that API to be already present in the ten
4848

4949
Now developers are able to specify **optional** attributes `appId` and `replyUrl` in `webApiPermissionRequests` section of `package-solution.json`.
5050

51-
When these attributes are present, administartors are presented standard Azure AD app registration consent as part of the API approval process.
51+
When these attributes are present, administrators are presented standard Azure AD app registration consent as part of the API approval process.
52+
53+
For more information on this feature, see: [Requesting permissions to Azure AD applications in another tenant](use-aadhttpclient.md#requesting-permissions-to-azure-ad-applications-in-another-tenant).
5254

5355
### New Action types for media - General Availability
5456

@@ -103,7 +105,7 @@ The action will be rendered as below:
103105

104106
![Select file button](../images/release-notes/114/file-action.jpg)
105107

106-
The Select Media Action can be used to select Images from your native device. In the browser it uses the file picker to help access relavant files:
108+
The Select Media Action can be used to select Images from your native device. In the browser it uses the file picker to help access relevant files:
107109

108110
![Select file panel](../images/release-notes/114/media-panel.jpg)
109111

docs/spfx/use-aadhttpclient.md

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Connect to Azure AD-secured APIs in SharePoint Framework solutions
33
description: Use the AadHttpClient class to connect to Azure AD-secured APIs in SharePoint Framework solutions.
4-
ms.date: 01/31/2023
4+
ms.date: 06/27/2023
55
ms.localizationpriority: high
66
---
77

@@ -11,7 +11,7 @@ When building SharePoint Framework solutions, you might need to connect to an AP
1111

1212
## Web API permissions overview
1313

14-
Azure AD secures a number of resources, from Office 365 to custom line-of-business applications built by the organization. To connect to these resources, applications must obtain a valid access token that grants them access to a particular resource. Applications can obtain an access token as part of the [OAuth authorization flow](/azure/active-directory/develop/active-directory-protocols-oauth-code).
14+
Azure AD secures a number of resources, from Microsoft 365 to custom line-of-business applications built by the organization. To connect to these resources, applications must obtain a valid access token that grants them access to a particular resource. Applications can obtain an access token as part of the [OAuth authorization flow](/azure/active-directory/develop/active-directory-protocols-oauth-code).
1515

1616
Client-side applications that are incapable of storing a secret, such as SharePoint Framework solutions, use a specific type of OAuth flow named [OAuth implicit flow](/azure/active-directory/develop/active-directory-dev-understanding-oauth2-implicit-grant).
1717

@@ -30,7 +30,7 @@ All permissions are granted to the whole tenant and not to a specific applicatio
3030

3131
## Discover available applications and permissions
3232

33-
The target Azure AD that secures your Office 365 tenant determines which applications you can request permissions for in your solution. The list of available applications might depend on the Office 365 license that the organization is using and which line-of-business applications they registered in Azure AD. If you have sufficient permissions, there are several ways that you can see which applications and permission scopes are available in your tenant.
33+
The target Azure AD that secures your Microsoft 365 tenant determines which applications you can request permissions for in your solution. The list of available applications might depend on the Microsoft 365 license that the organization is using and which line-of-business applications they registered in Azure AD. If you have sufficient permissions, there are several ways that you can see which applications and permission scopes are available in your tenant.
3434

3535
### Use Azure portal or Azure AD admin center
3636

@@ -170,6 +170,48 @@ If your SharePoint Framework solution requires permissions to specific resources
170170
> [!NOTE]
171171
> No matter if the administrator denies or approves the requested permissions, the solution can be deployed and used on sites. When building solutions that require additional permissions, you should never assume that the requested permissions have been granted.
172172
173+
### Requesting permissions to Azure AD applications in another tenant
174+
175+
The previous steps address adding a permission request to an Azure AD application defined in the same Azure AD tenant as your SharePoint Online tenant. However, when you want to grant a permission for an Azure AD application defined in another tenant (a multitenant Azure AD application), you must first add a service principal for that Azure AD application to your tenant.
176+
177+
> [!NOTE]
178+
> This capability was added in the [SPFx v1.15.2 release](release-1.15.2.md).
179+
180+
> [!IMPORTANT]
181+
> Azure AD applications have two types of principals. The application object is created when the Azure AD app is created; it is a *global* representation of the application across all tenants.
182+
>
183+
> Permissions are granted to service principals which are the *local* representation of the app for use in a specific tenant.
184+
>
185+
> When you create an Azure AD application in a tenant, both the application object & service principal are created in that tenant. But when you want to use the Azure AD application in another tenant, you must create a service principal for that application in your tenant.
186+
>
187+
> To learn more about Azure AD application principals, objects, and service principals, see: [Application and service principal objects in Azure Active Directory](/azure/active-directory/develop/app-objects-and-service-principals).
188+
189+
When you want to grant SharePoint Online permission to an Azure AD application defined in another tenant, you must include two additional properties in the SPFx project's **package-solution.json** file's `webApiPermissionRequests` entry:
190+
191+
```json
192+
{
193+
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
194+
"solution": {
195+
..
196+
"webApiPermissionRequests": [
197+
{
198+
"resource": "<API name as it's registered in Azure AD>",
199+
"scope": "<required permission scope>",
200+
"appId": "<GUID>",
201+
"replyUrl": "<URL>"
202+
}
203+
]
204+
..
205+
```
206+
207+
The two additional properties are:
208+
209+
- `appId`: This is the application object's ID for which a service principal will get created in the tenant.
210+
- `replyUrl`: This is the URL used by Azure AD during the consent and registration experience of the permission request.
211+
212+
> [!IMPORTANT]
213+
> If either `appid` or `replyUrl` are included, they are both required. In other words, include both properties (*if you're referencing an Azure AD app registered in another tenant from your SharePoint Online tenant*) or neither property (*if you're referencing an Azure AD app registered in the same tenant as your SharePoint Online tenant*).
214+
173215
## Manage permission requests
174216

175217
When you deploy SharePoint Framework solutions that request permissions to Azure AD applications, administrators are prompted to manage the permission request provided with the solution. Permission requests can be managed in several ways.
@@ -232,11 +274,10 @@ Global and SharePoint administrators can use the [CLI for Microsoft 365](https:/
232274
> Denying a permission request issued by a SharePoint Framework application doesn't prevent that application from being deployed in the app catalog and installed on sites.
233275
234276
- To *view which permissions have been granted* in your tenant, use the **[spo serviceprincipal grant list](https://pnp.github.io/cli-microsoft365/cmd/spo/serviceprincipal/serviceprincipal-grant-list/)** command. For each grant, the command displays the following information:
235-
236-
- **ObjectId**: The unique identifier for the permission grant.
237-
- **Resource**: The resource to which access has been granted.
238-
- **ResourceId**: The objectId of the resource service principal to which access has been granted.
239-
- **Scope**: The value of the scope claim that the resource application should expect in the OAuth 2.0 access token.
277+
- **ObjectId**: The unique identifier for the permission grant.
278+
- **Resource**: The resource to which access has been granted.
279+
- **ResourceId**: The objectId of the resource service principal to which access has been granted.
280+
- **Scope**: The value of the scope claim that the resource application should expect in the OAuth 2.0 access token.
240281

241282
- To *revoke a previously granted permission*, use the **[spo serviceprincipal grant revoke](https://pnp.github.io/cli-microsoft365/cmd/spo/serviceprincipal/serviceprincipal-grant-revoke/)** command. In the **grantId** parameter, specify the objectId of the grant that you want to revoke, which you can obtain by using the **spo serviceprincipal grant list** command.
242283

@@ -247,7 +288,7 @@ Global and SharePoint administrators can use the [CLI for Microsoft 365](https:/
247288

248289
Introduced in v1.4.1, the SharePoint Framework simplifies connecting to APIs secured with Azure AD. Using the new **AadHttpClient**, you can easily connect to APIs secured with Azure AD without having to implement authentication and authorization yourself.
249290

250-
Internally, the **AadHttpClient** implements the Azure AD OAuth flow leveraging Microsoft identity platform authentication libraries by using the **SharePoint Online Client Extensibility** service principal to obtain a valid access token. The **SharePoint Online Client Extensibility** service principal is provisioned by Microsoft and is available in the Azure AD of all Office 365 tenants.
291+
Internally, the **AadHttpClient** implements the Azure AD OAuth flow leveraging Microsoft identity platform authentication libraries by using the **SharePoint Online Client Extensibility** service principal to obtain a valid access token. The **SharePoint Online Client Extensibility** service principal is provisioned by Microsoft and is available in the Azure AD of all Microsoft 365 tenants.
251292

252293
1. To use the **AadHttpClient** in your SharePoint Framework solution, add the following `import` clause in your main web part file:
253294

@@ -307,11 +348,11 @@ Following are some considerations that you should take into account when working
307348

308349
### Request permissions via SharePoint Framework solutions
309350

310-
At this moment, it's only possible to request additional permissions through a SharePoint Framework solution. The request is started when the solution package (.sppkg) containing a permissions request is deployed in the app catalog. After the request is started, it can be approved or denied by a global or SharePoint administrator.
351+
It's only possible to request additional permissions through a SharePoint Framework solution. The request is started when the solution package (**/*.sppkg**) containing a permissions request is deployed in the app catalog. After the request is started, it can be approved or denied by a global or SharePoint administrator.
311352

312-
### Granted permissions apply to all solutions
353+
### Granted permissions apply to the entire tenant
313354

314-
Although permissions to Azure AD resources are being requested by a SharePoint Framework solution, once granted, they apply to the whole tenant and can be leveraged by any solution in that tenant.
355+
Although permissions to Azure AD resources are being requested by a SharePoint Framework solution, once granted, they apply to the entire tenant and can be leveraged by any client-side request in that tenant. This includes SPFx solutions and non-SPFx solutions because.
315356

316357
### Removing solution doesn't revoke permissions
317358

0 commit comments

Comments
 (0)