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

# OneDrive

> OneDrive is the Microsoft cloud service that connects you to all your files. It lets you store and protect your files, share them with others, and get to them from anywhere on all your devices.

## Creating an OneDrive connection

Create the connection by using one of the following methods:

* [OAuth](#using-oauth)
* [App Registration](#using-app-registration)

### Using OAuth

#### Creating your connection

1. In the Blink platform, navigate to the **Connections** page > **Add connection**. A New Connection dialog box opens displaying icons of external service providers available.
2. Select the **OneDrive** icon. A dialog box with name of the connection and connection methods appear.
3. (Optional) Edit the name of the connection. At a later stage you cannot edit the name.
4. Click **OneDrive** to authenticate using OAuth.
5. Sign in using your credentials.

> [!NOTE]
>
> Need admin approval? please refer to the [Need Admin
> Approval](https://docs.blinkops.com/docs/integrations/onedrive/admin-approval.md) guide.

### Using App Registration

To create the connection you need:

* A Client ID
* A Client Secret
* A Tenant ID

#### Obtaining the credentials

1. Log into the [Azure Portal](https://portal.azure.com/#home).

2. Go to the *Microsoft Entra ID* resource.

   ![Azure Active Directory Resource](https://mintcdn.com/blinkops-2/LiDiL34PEmIGHJGK/img/ActiveDirectory/azure_active_directory.png?fit=max\&auto=format\&n=LiDiL34PEmIGHJGK\&q=85\&s=57246fca73df6e9ce3f39594b5c944bf)

3. In the left-hand menu, click **App registrations**.

   ![App Registrations](https://mintcdn.com/blinkops-2/LiDiL34PEmIGHJGK/img/ActiveDirectory/app_registrations.png?fit=max\&auto=format\&n=LiDiL34PEmIGHJGK\&q=85\&s=aa4834712de9b57c079d56adb68abc7f)

4. Create a new application registration or click on one of your existing applications.

   ![My App](https://mintcdn.com/blinkops-2/LiDiL34PEmIGHJGK/img/ActiveDirectory/my_app1.png?fit=max\&auto=format\&n=LiDiL34PEmIGHJGK\&q=85\&s=bc11b1db3698cb119e105eaa7e699f6b)

5. In the left-hand menu, click **API permissions**.

   ![API Permissions](https://mintcdn.com/blinkops-2/LiDiL34PEmIGHJGK/img/ActiveDirectory/api_permissions.png?fit=max\&auto=format\&n=LiDiL34PEmIGHJGK\&q=85\&s=b0ed7c3e06ffd15e35fb078b7b3f0e78)

6. Click **Add a permission** and select **Microsoft Graph**.

   ![Add Permission](https://mintcdn.com/blinkops-2/LiDiL34PEmIGHJGK/img/ActiveDirectory/add_permission.png?fit=max\&auto=format\&n=LiDiL34PEmIGHJGK\&q=85\&s=036e402e171051eb562e528089ba7d9f)

7. Choose **Application permissions** and mark the permissions you wish to add.

   ![Application Permissions](https://mintcdn.com/blinkops-2/LiDiL34PEmIGHJGK/img/ActiveDirectory/application_permissions.png?fit=max\&auto=format\&n=LiDiL34PEmIGHJGK\&q=85\&s=96ae24085dfac2547b72a7abbc82eca4)

To support all Blink actions, these are the required **application** permissions:

> [!NOTE]
>
> As a best practice, request the **least privileged permissions** that your app
> needs in order to access data and function correctly. Requesting permissions
> with more than the necessary privileges is poor security practice, which may
> cause users to refrain from consenting and affect your app's usage. For
> additional information, refer to [Microsoft Graph
> permissions](https://learn.microsoft.com/en-us/graph/permissions-reference).

| Least privileged permissions | Higher privileged permissions |
| - | - |
| Files.ReadWrite.All | Sites.ReadWrite.All |
| Files.Read.All | Files.ReadWrite.All |
| | Sites.Read.All |

8. Click **Add permissions** to save the changes.

9. Click **Grant admin consent for `<your tenant>`** on the API permissions page. **Only admins can grant consent**.

   ![Grant Admin Consent](https://mintcdn.com/blinkops-2/LiDiL34PEmIGHJGK/img/ActiveDirectory/grant_admin_consent.png?fit=max\&auto=format\&n=LiDiL34PEmIGHJGK\&q=85\&s=ae92df915ab2cd3ffb8d3241752e6e56)

10. Confirm that the added permissions are now verified.

    ![Granted Admin Consent](https://mintcdn.com/blinkops-2/LiDiL34PEmIGHJGK/img/ActiveDirectory/granted_azure.png?fit=max\&auto=format\&n=LiDiL34PEmIGHJGK\&q=85\&s=2d18748d4cede7a080065283e0f118a4)

11. Navigate to **Overview** and Copy your **client ID** and **tenant ID**.

    ![Client ID & Tenant ID](https://mintcdn.com/blinkops-2/LiDiL34PEmIGHJGK/img/ActiveDirectory/client_tenant.png?fit=max\&auto=format\&n=LiDiL34PEmIGHJGK\&q=85\&s=7faa71341ef29fce86e62d436472e630)

12. Create a new **client secret**.

    ![Client Secret](https://mintcdn.com/blinkops-2/LiDiL34PEmIGHJGK/img/ActiveDirectory/secret.png?fit=max\&auto=format\&n=LiDiL34PEmIGHJGK\&q=85\&s=9d1dfac219ab431a28a8c0d5219b96f1)

13. Copy the **secret value**.

    ![Client Secret](https://mintcdn.com/blinkops-2/LiDiL34PEmIGHJGK/img/ActiveDirectory/secret_value.png?fit=max\&auto=format\&n=LiDiL34PEmIGHJGK\&q=85\&s=8c7709585443b3044f2c17e3e9493ed9)

#### Creating your connection

1. In the Blink platform, navigate to the **Connections** page > **Add connection**. A New Connection dialog box opens displaying icons of external service providers available.

2. Select the **OneDrive** icon. A dialog box with name of the connection and connection methods appear.

3. (Optional) Edit the name of the connection. At a later stage you cannot edit the name.

4. Select **Service Account** as the method to create the connection.

5. Fill in the parameters:

   * The client ID
   * The client secret
   * The tenant ID

6. (Optional) Click **Test Connection** to test it.

7. Click **Create connection**. The new connection appears on the **Connections** page.
