# Grant Access to Selected Sites

Grant Azure Application Permission for a Specific SharePoint Site

To ensure proper integration and access, follow the steps below to grant the **Sites.Selected** permission to your Azure AD application using the Microsoft Graph API.

### Step 1: Open Microsoft Graph Explorer

1. Visit the Microsoft Graph Explorer:\
   <https://developer.microsoft.com/en-us/graph/graph-explorer>
2. Sign in using your Microsoft account to proceed.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FOFwwRLytL8TNYdC58tvZ%2Fimage.png?alt=media&#x26;token=dd58ff05-d9f1-4136-964c-c8d2fb0afe38" alt=""><figcaption></figcaption></figure>

### Step 2: Retrieve the SharePoint Site ID

Use the following API request to get the Site ID of your target SharePoint site:

GET <https://graph.microsoft.com/v1.0/sites/{tenant-name}.sharepoint.com:/sites/{site-name}>

In the example shown, the site URL is visible and can be referenced from the browser's address bar.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2F9dRBSlXGgussBQP36wK0%2Fimage.png?alt=media&#x26;token=adc86ef7-f206-473d-a07e-ed04156d8b8e" alt=""><figcaption></figcaption></figure>

Once the query is run, it returns the Site ID in the response. If the query does not return a response, click on Modify Permissions in Graph Explorer and allow the required access. This access is requested by Microsoft and is safe to grant.

After the permissions are granted, run the query again. The response will contain the Site ID, which you can copy for use in the next step.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FFJAvFb1aFcTtwpzR5cd0%2Fimage.png?alt=media&#x26;token=e61db4ef-10ff-4598-94b2-f2610b7d42ed" alt=""><figcaption><p>Copy the highlighted Site ID as you'll need it in the next step.</p></figcaption></figure>

### Step 3: Grant Permissions Using the Site ID

Once you have the Site ID, use the following API with the POST method to grant permissions:

POST <https://graph.microsoft.com/v1.0/sites/{site-id}/permissions>

In this case, the example API with the Site ID looks like:|\
\
POST <https://graph.microsoft.com/v1.0/sites/a634ebd4-ae97-4317-8f15-6cd58a651b0c/permissions>

In the request body, include the JSON payload with the roles and application details.

Example:

```
{
  "roles": ["fullcontrol"],
  "grantedToIdentities": [
    {
      "application": {
        "id": "{your app Id}",
        "displayName": "{your app display name}"
      }
    }
  ]
}
```

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2F4tvbT1nps5cDm1FEUfRn%2Fimage.png?alt=media&#x26;token=e4accc64-cc40-457d-9688-adf1981f4de7" alt=""><figcaption></figcaption></figure>

If an error occurs after submitting the request, click on Modify Permissions again and grant the permissions requested by Graph Explorer.

Once the necessary permissions are granted, re-run the query. It should return a response confirming the permission assignment.

### Step 4: Verify Permission Assignment

After successful execution, you will receive a response like the following:

```
{
  "roles": ["fullcontrol"],
  "grantedToIdentities": [
    {
      "application": {
        "id": "79871c67-c281-41b0-999e-5c1a20c878d5",
        "displayName": "Inogic Site Selected"
      }
    }
  ]
}
```

After the permission has been successfully granted, log out of Graph Explorer and try to authenticate the SharePoint connector. The connector should now be successfully authenticated.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FRh91WMd0d3OjrHfKSkNB%2Fimage.png?alt=media&#x26;token=b7df3d34-12a3-49df-a590-ecc6c2861483" alt=""><figcaption></figcaption></figure>

If you receive an error after executing this request, it usually means additional permission consent is required.\
Click on "Modify permissions" in Graph Explorer and grant the permissions requested.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FHxV3mV2vm5hofhl12qKB%2Fimage.png?alt=media&#x26;token=589d72d4-458e-499c-b6c6-51a21634aa10" alt=""><figcaption></figcaption></figure>

Once the permission is granted successfully, the response will confirm it.

```
{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites('a634ebd4-ae97-4317-8f15-6cd58a651b0c')/permissions/$entity",
  "id": "aTowaS50fG1zLnNwLmV4dHw3OTg3MWM2Ny1jMjgxLTQxYjAtOTk5ZS01YzFhMjBjODc4ZDVAOGNhYmFjODYtMTYwYi00NmU2LTkwZWQtNTBlNmIxMGQ5M2Vl",
  "roles": ["fullcontrol"],
  "grantedToIdentitiesV2": [
    {
      "application": {
        "displayName": "Inogic Site Selected",
        "id": "79871c67-c281-41b0-999e-5c1a20c878d5"
      }
    }
  ],
  "grantedToIdentities": [
    {
      "application": {
        "displayName": "Inogic Site Selected",
        "id": "79871c67-c281-41b0-999e-5c1a20c878d5"
      }
    }
  ]
}

```

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FvTMGLTh6FZ1FP8xkAWNA%2Fimage.png?alt=media&#x26;token=32a03a5f-9845-415d-9bf7-94317a65755d" alt=""><figcaption></figcaption></figure>

### Step 5: Test the Connector Authentication

After successfully granting permissions:

* Log out from Graph Explorer.
* Re-authenticate the SharePoint connector in SharePoint Security Tool.
* It should now be authenticated successfully.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.inogic.com/sharepoint-security-sync/configuration/connector-configuration/authenticate-connector/grant-access-to-selected-sites.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
