> ## Documentation Index
> Fetch the complete documentation index at: https://www.c1.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up a Microsoft SharePoint connector

> C1 provides identity governance for SharePoint. Integrate your SharePoint instance with C1 for unified visibility and governance over user access.

## Capabilities

| Resource            | Sync                                                          | Provision |
| :------------------ | :------------------------------------------------------------ | :-------- |
| Accounts            | ℹ️                                                            |           |
| Sites               | <Icon icon="square-check" iconType="solid" color="#c937ae" /> |           |
| SharePoint groups   | <Icon icon="square-check" iconType="solid" color="#c937ae" /> |           |
| Security principals | <Icon icon="square-check" iconType="solid" color="#c937ae" /> |           |

<Info>
  This connector must pull account information from another connector. You'll configure this relationship when setting up the connector.
</Info>

## Gather SharePoint credentials

Each setup method requires you to pass in credentials generated in SharePoint. Gather these credentials before you move on.

<Warning>
  A user with at least the **Cloud Application Administrator** permission in Azure must perform this task.
</Warning>

### Create a new application

<Steps>
  <Step>
    In Microsoft Entra admin center, navigate to **App registrations**.
  </Step>

  <Step>
    Click **New registration**.
  </Step>

  <Step>
    Give the application a name, such as "C1", and select the relevant supported account type. You do not need to set a redirect URI.
  </Step>

  <Step>
    Click **Register**.
  </Step>

  <Step>
    The new app is created. Carefully copy and save the **Application (client) ID** and the **Directory (tenant) ID** shown on the application summary page.
  </Step>

  <Step>
    Next, we'll generate a client secret for this app. Click **Certificates & secrets**.
  </Step>

  <Step>
    Click **+ New client secret**.
  </Step>

  <Step>
    Give the client secret a description and set its expiration.
  </Step>

  <Step>
    Click **Add**.
  </Step>

  <Step>
    The client secret is generated. Carefully copy and save the **Secret Value**.
  </Step>
</Steps>

### Give the new application API permissions

<Steps>
  <Step>
    Click **API permissions**.
  </Step>

  <Step>
    Click **+ Add permissions** > **Microsoft Graph**.
  </Step>

  <Step>
    Click **Application permissions** and select `Sites.Read.All`.
  </Step>

  <Step>
    Click **+ Add permissions** > **Microsoft SharePoint**.
  </Step>

  <Step>
    Click **Application permissions** and select `Sites.FullControl.All`. (You can use `Sites.Read.All` here if you do not need to sync special SharePoint groups such as "SharePointHome Org Links".)
  </Step>

  <Step>
    Save your changes.
  </Step>
</Steps>

### Create and upload a self-signed certificate

Next, you'll create a **self-signed certificate** and a **private key** in PEM format using OpenSSL. The commands to create the certificate are the same regardless of your operating system.

<Steps>
  <Step>
    Use the following command to create both a private key and a self-signed certificate. Be sure to replace `your_domain_name` with your actual domain or a descriptive name.

    ```bash theme={"theme":{"light":"css-variables","dark":"css-variables"}}
    openssl req -x509 -nodes -newkey rsa:4096 -keyout your_domain_name.key -out your_domain_name.crt -sha256 -days 365
    ```
  </Step>

  <Step>
    Next, you'll be prompted to enter details for the certificate. The most crucial field here is the **Common Name**.

    For the Common Name, enter your domain (such as `example.com`).
  </Step>

  <Step>
    Once the process is complete, two files will be created in your current directory:

    * `your_domain_name.key`: This is your **private key**
    * `your_domain_name.crt`: This is your **self-signed certificate** in PEM format
  </Step>

  <Step>
    Upload the certificate to your application by navigating to **Certificates & secrets** > **Certificates**.
  </Step>
</Steps>

**Done.** Next, move on to the connector configuration instructions.

## Configure the SharePoint connector

<Warning>
  To complete this task, you'll need:

  * The **Connector Administrator** or **Super Administrator** role in C1
  * Access to the set of SharePoint credentials generated by following the instructions above
</Warning>

<Tabs>
  <Tab title="Cloud-hosted">
    **Follow these instructions to use a built-in, no-code connector hosted by C1.**

    <Steps>
      <Step>
        In C1, navigate to **Integrations** > **Connectors** and click **Add connector**.
      </Step>

      <Step>
        Search for **SharePoint** and click **Add**.

        **Don't see the SharePoint connector?** Reach out to [support@c1.ai](mailto:support@c1.ai) to add SharePoint to your **Connectors** page.
      </Step>

      <Step>
        Choose how to set up the new SharePoint connector:

        * Add the connector to a currently unmanaged app (select from the list of apps that were discovered in your identity, SSO, or federation provider that aren't yet managed with C1)

        * Add the connector to a managed app (select from the list of existing managed apps)

        * Create a new managed app
      </Step>

      <Step>
        Set the owner for this connector. You can manage the connector yourself, or choose someone else from the list of C1 users. Setting multiple owners is allowed.

        If you choose someone else, C1 will notify the new connector owner by email that their help is needed to complete the setup process.
      </Step>

      <Step>
        Click **Next**.
      </Step>

      <Step>
        Find the **Settings** area of the page and click **Edit**.
      </Step>

      <Step>
        Paste the client ID into the **Client ID** field.
      </Step>

      <Step>
        Paste the client secret into the **Client secret** field.
      </Step>

      <Step>
        Paste the tenant ID into the **Tenant ID** field.
      </Step>

      <Step>
        Enter your domain for the Microsoft Graph API in the **Graph domain** field. The default is `graph.microsoft.com`.
      </Step>

      <Step>
        Upload your self-signed certificate to the **PEM certificate** field.
      </Step>

      <Step>
        Upload the key for your certificate in the **PEM key** field.
      </Step>

      <Step>
        Enter your SharePoint subdomain in the **SharePoint domain** field. (For example, enter `subdomain` if you access SharePoint at `subdomain.sharepoint.com`)
      </Step>

      <Step>
        Click **Save**.
      </Step>

      <Step>
        Finally, tell the connector where to find the identities that will be used for this app in C1.

        1. In the **Shared identity source** area of the page, click **Edit**.

        2. Select the connector from which you want to pull identities.

        3. **Optional.** Limit the identities pulled from the connector you selected to only those with a certain entitlement by setting the entitlement.

        4. Click **Save**.
      </Step>

      <Step>
        The connector's label changes to **Syncing**, followed by **Connected**. You can view the logs to ensure that information is syncing.
      </Step>
    </Steps>

    **Done.** Your SharePoint connector is now pulling access data into C1.
  </Tab>

  <Tab title="Self-hosted">
    **Follow these instructions to use the SharePoint connector, hosted and run in your own environment.**

    When running in service mode on Kubernetes, a self-hosted connector maintains an ongoing connection with C1, automatically syncing and uploading data at regular intervals. This data is immediately available in the C1 UI for access reviews and access requests.

    ### Resources

    [Contact C1's support team](mailto:support@c1.ai) to download the latest version of the connector.

    ### Step 1: Configure the SharePoint connector

    <Steps>
      <Step>
        In C1, navigate to **Integrations** > **Connectors** > **Add connector**.
      </Step>

      <Step>
        Search for **Baton** and click **Add**.
      </Step>

      <Step>
        Choose how to set up the new SharePoint connector:

        * Add the connector to a currently unmanaged app (select from the list of apps that were discovered in your identity, SSO, or federation provider that aren't yet managed with C1)

        * Add the connector to a managed app (select from the list of existing managed apps)

        * Create a new managed app
      </Step>

      <Step>
        Set the owner for this connector. You can manage the connector yourself, or choose someone else from the list of C1 users. Setting multiple owners is allowed.

        If you choose someone else, C1 will notify the new connector owner by email that their help is needed to complete the setup process.
      </Step>

      <Step>
        Click **Next**.
      </Step>

      <Step>
        In the **Settings** area of the page, click **Edit**.
      </Step>

      <Step>
        Click **Rotate** to generate a new Client ID and Secret.

        Carefully copy and save these credentials. We'll use them in Step 2.
      </Step>
    </Steps>

    ### Step 2: Create Kubernetes configuration files

    Create two Kubernetes manifest files for your SharePoint connector deployment:

    #### Secrets configuration

    ```yaml expandable theme={"theme":{"light":"css-variables","dark":"css-variables"}}
    # baton-sharepoint-secrets.yaml
    apiVersion: v1
    kind: Secret
    metadata:
      name: baton-sharepoint-secrets
    type: Opaque
    stringData:
      # C1 credentials
      BATON_CLIENT_ID: <C1 client ID>
      BATON_CLIENT_SECRET: <C1 client secret>
      
      # SharePoint credentials
      BATON_AZURE_CLIENT_ID: <Azure client ID>
      BATON_AZURE_CLIENT_SECRET: <Azure client secret>
      BATON_AZURE_TENANT_ID: <Azure tenant ID>
      BATON_AZURE_GRAPH_DOMAIN: <Microsoft Graph API domain (default is graph.microsoft.com)>
      BATON_PEM_CERTIFICATE: <Base-64 encoded PEM certificate>
      BATON_PEM_CERTIFICATE_KEY: <Base-64 encoded private key>
      BATON_SHAREPOINT_DOMAIN: <SharePoint subdomain (for example, "subdomain" in "subdomain.sharepoint.com")>
      BATON_EXTERNAL_SYNC_MODE: true
      BATON_EXTERNAL_RESOURCE_C1Z: <The path to the c1z file to sync external Baton resources with>
      BATON_EXTERNAL_RESOURCE_ENTITLEMENT_ID_FILTER: <Optional. The entitlement that external users, groups must have access to sync external Baton resources>
    ```

    See the connector's README or run `--help` to see all available configuration flags and environment variables.

    #### Deployment configuration

    ```yaml expandable theme={"theme":{"light":"css-variables","dark":"css-variables"}}
    # baton-sharepoint.yaml
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: baton-sharepoint
      labels:
        app: baton-sharepoint
    spec:
      selector:
        matchLabels:
          app: baton-sharepoint
      template:
        metadata:
          labels:
            app: baton-sharepoint
            baton: true
            baton-app: sharepoint
        spec:
          containers:
          - name: baton-sharepoint
            image: ghcr.io/conductorone/baton-sharepoint:latest
            imagePullPolicy: IfNotPresent
            env:
            - name: BATON_HOST_ID
              value: baton-sharepoint
            envFrom:
            - secretRef:
                name: baton-sharepoint-secrets
    ```

    ### Step 3: Deploy the connector

    <Steps>
      <Step>
        Create a namespace in which to run C1 connectors (if desired), then apply the secret config and deployment config files.
      </Step>

      <Step>
        Check that the connector data uploaded correctly. In C1, click **Apps**. On the **Managed apps** tab, locate and click the name of the application you added the SharePoint connector to. SharePoint data should be found on the **Entitlements** and **Accounts** tabs.
      </Step>
    </Steps>

    **Done.** Your SharePoint connector is now pulling access data into C1.
  </Tab>
</Tabs>
