Skip to content

Commit 966a4da

Browse files
authored
SharePoint source connector: clean up SharePoint app principal how-to instructions (#388)
1 parent 83457ea commit 966a4da

File tree

3 files changed

+97
-24
lines changed

3 files changed

+97
-24
lines changed

snippets/general-shared-text/sharepoint-cli-api.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import AdditionalIngestDependencies from '/snippets/general-shared-text/ingest-d
1010

1111
The following environment variables:
1212

13-
- `SHAREPOINT_APP_CLIENT_ID` - The SharePoint application (client) ID, represented by `--client-id` (CLI) or `client_id` (Python).
14-
- `SHAREPOINT_APP_CLIENT_SECRET` - The client secret for the SharePoint application, represented by `--client-cred` (CLI) or `client_cred` (Python).
13+
- `SHAREPOINT_APP_CLIENT_ID` - The application (client) ID for the SharePoint app principal, represented by `--client-id` (CLI) or `client_id` (Python).
14+
- `SHAREPOINT_APP_CLIENT_SECRET` - The client secret for the SharePoint app principal, represented by `--client-cred` (CLI) or `client_cred` (Python).
1515
- `SHAREPOINT_SITE` - The SharePoint site URL, represented by `--site` (CLI) or `site` (Python).
1616
- `SHAREPOINT_PATH` - The path in the SharePoint site from which to start parsing files, represented by `--path` (CLI) or `path` (Python).
1717

snippets/general-shared-text/sharepoint-platform.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ Fill in the following fields:
44
- **Site URL** (_required_): The base URL of the SharePoint site to connect to.
55
- **Path** (_required_): The path from which to start parsing files, for example `Shared Documents`.
66
- **Recursive** (source connector only): Check this box to recursively process data from subfolders within the specified path.
7-
- **Client ID** (_required_): The client ID provided by SharePoint for the app registration.
7+
- **Client ID** (_required_): The client ID provided by SharePoint for the app principal.
88
- **Client Credentials** (_required_): The client secret associated with the client ID.
Lines changed: 94 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,107 @@
11
- The SharePoint site URL.
22

3-
- Site URLs typically have the format `https://<tenant>.sharepoint.com`.
4-
- Relative site URLs typically have the format `https://<tenant>.sharepoint.com/sites/<site_name>`.
5-
- To process all sites within a tenant, use a site URL of `https://<tenant>-admin.sharepoint.com`. This requires the app to be registered at a tenant level.
3+
- Site collection-level URLs typically have the format `https://<tenant>.sharepoint.com/sites/<site-collection-name>`.
4+
- Root site collection-level URLs typically have the format `https://<tenant>.sharepoint.com`.
5+
- To process all sites within a tenant, use a site URL of `https://<tenant>-admin.sharepoint.com`.
66

77
[Learn more](https://learn.microsoft.com/microsoft-365/community/query-string-url-tricks-sharepoint-m365).
88

99
- The path in the SharePoint site from which to start parsing files, for example `"Shared Documents"`. If the connector is to process all sites within the tenant, this filter will be applied to all site document libraries.
10-
- A SharePoint app principal with its application (client) ID, client secret, and access permissions to the SharePoint instance. [Get a client ID and client secret, and set access permissions](https://github.com/vgrem/Office365-REST-Python-Client/wiki/How-to-connect-to-SharePoint-Online-and-and-SharePoint-2013-2016-2019-on-premises--with-app-principal).
10+
- A SharePoint app principal with its application (client) ID, client secret, and the appropriate access permissions.
1111

12-
You can create SharePoint app principals through `https://<tenant>.sharepoint.com/_layouts/15/appregnew.aspx`.
12+
Complete the steps in the following sections, depending on whether you want to access sites at the site collection level, the
13+
root site collection level, or all sites within a tenant.
14+
15+
<Note>
16+
Two of the main factors in the following sections are the scope of access
17+
and the level of administrative permissions required to create the app principal. Tenant-wide app principals offer the broadest access
18+
but require the highest level of administrative rights, while site collection app principals are more restricted but can be created by users
19+
with lower-level permissions.
20+
</Note>
1321

14-
For a SharePoint app principal with site-scoped permissions, use app permission request XML such as the following to grant
15-
permissions through `https://<tenant>.sharepoint.com/_layouts/15/appinv.aspx`:
22+
## Tenant-wide SharePoint app principals
1623

17-
```xml
18-
<AppPermissionRequests AllowAppOnlyPolicy="true">
19-
<AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl" />
20-
</AppPermissionRequests>
21-
```
24+
Create a tenant-wide SharePoint app principal when you want the power and flexibility of a principal that can process all sites within a tenant.
2225

23-
For a SharePoint app principal with tenant-scoped permissions, use app permission request XML such as the following to grant
24-
permissions through `https://<tenant>-admin.sharepoint.com/_layouts/15/appinv.aspx` instead:
26+
SharePoint app principals that are created in the SharePoint admin center have tenant-wide scope and can potentially access all sites within the tenant.
27+
Only global or SharePoint administrators typically have access to the following URLs.
2528

26-
```xml
27-
<AppPermissionRequests AllowAppOnlyPolicy="true">
28-
<AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" />
29-
</AppPermissionRequests>
30-
```
29+
1. To create a tenant-wide SharePoint app principal and then get its client ID and client secret, go to the following URL:
3130

32-
Available `Right` settings include `Read`, `Write`, `Manage`, and `FullControl`. To learn more, see
33-
[Add-in permissions in SharePoint](https://learn.microsoft.com/sharepoint/dev/sp-add-ins/add-in-permissions-in-sharepoint).
31+
`https://<tenant>-admin.sharepoint.com/_layouts/15/appregnew.aspx`
3432

33+
2. To add access permissions to a tenant-wide SharePoint app principal and then get its client ID and client secret, go to the following URL:
34+
35+
`https://<tenant>.sharepoint.com/_layouts/15/appinv.aspx`
36+
37+
3. Apply the following permissions XML to the tenant-wide SharePoint app principal:
38+
39+
```xml
40+
<AppPermissionRequests AllowAppOnlyPolicy="true">
41+
<AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" />
42+
</AppPermissionRequests>
43+
```
44+
Available `Right` settings include `Read`, `Write`, `Manage`, and `FullControl`. To learn more, see
45+
[Add-in permissions in SharePoint](https://learn.microsoft.com/sharepoint/dev/sp-add-ins/add-in-permissions-in-sharepoint).
46+
47+
[Learn how to complete these preceding steps](https://github.com/vgrem/Office365-REST-Python-Client/wiki/How-to-connect-to-SharePoint-Online-and-and-SharePoint-2013-2016-2019-on-premises--with-app-principal).
48+
Be sure to substitute the URLs and XML in the linked article with the ones in these preceding steps accordingly.
49+
50+
## Root site collection-level SharePoint app principals
51+
52+
Create a root site collection-level SharePoint app principal when you want a principal that can only access a root site collection, for example with a URL
53+
that has the format `https://<tenant>.sharepoint.com`.
54+
55+
SharePoint app principals that are created at the root site collection level have a scope limited to the root site collection. Site collection administrators can usually access the following URLs.
56+
57+
1. To create a root site collection-level SharePoint app principal and then get its client ID and client secret, go to the following URL:
58+
59+
`https://<tenant>.sharepoint.com/_layouts/15/appregnew.aspx`
60+
61+
2. To add access permissions to a root site collection-level SharePoint app principal, go to the following URL:
62+
63+
`https://<tenant>.sharepoint.com/_layouts/15/appinv.aspx`
64+
65+
3. Apply the following permissions XML to the root site collection-level SharePoint app principal:
66+
67+
```xml
68+
<AppPermissionRequests AllowAppOnlyPolicy="true">
69+
<AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl" />
70+
</AppPermissionRequests>
71+
```
72+
73+
Available `Right` settings include `Read`, `Write`, `Manage`, and `FullControl`. To learn more, see
74+
[Add-in permissions in SharePoint](https://learn.microsoft.com/sharepoint/dev/sp-add-ins/add-in-permissions-in-sharepoint).
75+
76+
[Learn how to complete these preceding steps](https://github.com/vgrem/Office365-REST-Python-Client/wiki/How-to-connect-to-SharePoint-Online-and-and-SharePoint-2013-2016-2019-on-premises--with-app-principal).
77+
Be sure to substitute the URLs and XML in the linked article with the ones in these preceding steps accordingly.
78+
79+
## Site collection-level SharePoint app principals
80+
81+
Create a site collection-level SharePoint app principal when you want a principal that can only access a specific site collection, for example with a URL
82+
that has or starts with the format `https://<tenant>.sharepoint.com/sites/<site-collection-name>`.
83+
84+
SharePoint app principals that are created at the site collection level have the most limited scope, restricted to the specific subsite and its subsites.
85+
Site owners or those with appropriate permissions on the subsite can access the following URLs.
86+
87+
1. To create a site collection-level SharePoint app principal, go to the following URL:
88+
89+
`https://<tenant>.sharepoint.com/sites/<site-collection-name>/_layouts/15/appregnew.aspx`
90+
91+
2. To add access permissions to a site collection-level SharePoint app principal, go to the following URL:
92+
93+
`https://<tenant>.sharepoint.com/sites/<site-collection-name>/_layouts/15/appinv.aspx`
94+
95+
3. Apply the following permissions XML to the site collection-level SharePoint app principal:
96+
97+
```xml
98+
<AppPermissionRequests AllowAppOnlyPolicy="true">
99+
<AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl" />
100+
</AppPermissionRequests>
101+
```
102+
103+
Available `Right` settings include `Read`, `Write`, `Manage`, and `FullControl`. To learn more, see
104+
[Add-in permissions in SharePoint](https://learn.microsoft.com/sharepoint/dev/sp-add-ins/add-in-permissions-in-sharepoint).
105+
106+
[Learn how to complete these preceding steps](https://github.com/vgrem/Office365-REST-Python-Client/wiki/How-to-connect-to-SharePoint-Online-and-and-SharePoint-2013-2016-2019-on-premises--with-app-principal).
107+
Be sure to substitute the URLs and XML in the linked article with the ones in these preceding steps accordingly.

0 commit comments

Comments
 (0)