Skip to content
← Back to Command · Connectors

Command · Connector setup

Set up the Microsoft SharePoint Connector with Sites.Selected

Connect raia Command to SharePoint using the Sites.Selected permission so the connector can only read the specific sites you explicitly share with it — not the entire tenant. This guide walks through the full flow: Azure app registration, permission grant, client secret, per-site authorization via Microsoft Graph, and verification inside Command.

Video walkthrough is available in English.

01

Overview

Sites.Selected is a Microsoft Graph permission: with the application version, the app can reach only sites where it has been granted access, after admin consent and with a valid token for that scope. Other consented permissions on the same app still apply, so review the app's full grant set.

When it is the only SharePoint permission granted to the app, it is a least-privilege option for enterprise deployments. It is easier to justify in security reviews than the tenant-wide reach of Sites.Read.All or Sites.FullControl.All.

PermissionScope
Sites.SelectedApplication permission: access only the sites an administrator explicitly grants to the app (read or write is set per site). Recommended.
Sites.Read.AllRead every site in the tenant. Broad, hard to defend in security reviews.
Sites.FullControl.AllFull control of every site. Never add it to the connector app. Separately, the admin who creates the per-site grant in Step 05 consents to the delegated version in Graph Explorer.
02

Register the Azure AD app

Create a dedicated app registration for the raia SharePoint connector. Single tenant is the right choice for most deployments.

  1. 01

    Sign in to the Azure Portal and open Microsoft Entra ID → App registrations.

  2. 02

    Click New registration. Give it a clear name (for example, raia SharePoint Connector) and pick Single tenant. Leave the redirect URI empty.

  3. 03

    After the app is created, copy the Application (client) ID and the Directory (tenant) ID from the Overview page — you'll paste these into Command later.

  4. 04

    Keep the Overview tab open; you'll need the display name in Step 05.

03

Add the Sites.Selected Graph permission

Grant the app the narrowest SharePoint permission Microsoft supports, then have an admin consent to it.

  1. 01

    In the app registration, open API permissions → Add a permission → Microsoft Graph → Application permissions.

  2. 02

    Search for Sites.Selected, check it, and click Add permissions.

  3. 03

    Back on the API permissions page, click Grant admin consent for <your tenant>. Confirm the status turns to Granted.

  4. 04

    Do not add Sites.Read.All or Files.ReadWrite.All — those defeat the purpose of Sites.Selected.

Admin consent is required

Application permissions on Microsoft Graph need admin consent from an administrator whose role allows it (for example, Privileged Role Administrator or Global Administrator). Without consent, the connector cannot read any site.
04

Create a client secret

Generate a secret so raia can authenticate as the app, then paste it into the SharePoint connector form in Command.

  1. 01

    In the app registration, open Certificates & secrets → Client secrets → New client secret.

  2. 02

    Give it a description (for example, raia connector) and pick an expiry that matches your rotation policy.

  3. 03

    Immediately copy the Value column — not the Secret ID. The Value is only shown once and cannot be retrieved later.

  4. 04

    Open raia Command → Connectors → Microsoft SharePoint and paste the Tenant ID, Client ID, and Client Secret into the connector form.

  5. 05

    Save the form. If a connection test is offered, a pass only confirms the app credentials; individual sites still fail until you complete Step 05.

Return to Command’s SharePoint connector after completing the Azure registration, then Add connection.
  1. Highlight 1: Setup instructions for the provider side
  2. Highlight 2: Add connection starts a new connection

Store the secret immediately

Azure only shows the secret Value once. If you close the page before copying it, delete the secret and create a new one. Rotate the secret on the same cadence as your other production credentials.
05

Grant the app access to a specific site

Sites.Selected only unlocks the mechanism — it does not grant access to any site. For each SharePoint site you want the connector to read, you have to explicitly grant the app permission using Microsoft Graph.

A SharePoint site is identified by a composite ID with three comma-separated parts: {hostname},{site-collection-id},{site-id}. The easiest way to get it — and to run the grant — is Microsoft Graph Explorer at developer.microsoft.com/graph/graph-explorer.

Step A — resolve the site ID

Sign in to Graph Explorer with a tenant admin account and run a GET to look up the site by its server-relative path:

http
GET https://graph.microsoft.com/v1.0/sites/{hostname}:/sites/{site-name}

For example, if the site URL is https://contoso.sharepoint.com/sites/ThomasTestSite1:

http
GET https://graph.microsoft.com/v1.0/sites/contoso.sharepoint.com:/sites/ThomasTestSite1

The response's id field is the composite site ID. Copy the full string — you'll need it in Step B.

Step B — grant read access to the app

Change the method to POST, paste the URL below (substituting the site ID from Step A), and send the JSON body:

http
POST https://graph.microsoft.com/v1.0/sites/{site-id}/permissions
Content-Type: application/json
json
{
  "roles": ["read"],
  "grantedToIdentities": [
    {
      "application": {
        "id": "{APPLICATION_CLIENT_ID}",
        "displayName": "{APPLICATION_DISPLAY_NAME}"
      }
    }
  ]
}

Expect a 403 on your first attempt

Creating a site permission needs Sites.FullControl.All, which Graph Explorer does not include by default. Open the Modify permissions tab, find Sites.FullControl.All and consent for your signed-in admin account. This is a delegated permission for Graph Explorer acting as you, not an application permission for the raia connector app. The consent stays until it is revoked, so review or remove it afterwards under your policy. Re-run the POST; a successful grant returns 201 Created.

Repeat Step 05 for every SharePoint site you want the connector to read. Remove access at any time by DELETEing the permission from the same endpoint.

06

Verify in raia Command

Confirm the connector can now see the site you just authorized.

  1. 01

    Return to Command → Connectors → Microsoft SharePoint.

  2. 02

    Enter the site URL (or path) into the Test permissions field.

  3. 03

    The site should resolve successfully. If it still fails, wait a minute for the Graph permission to propagate, then re-check the permission was created against the correct site ID.

07

Related