OneDrive for Business

The OneDrive for Business integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] allows you to use OneDrive for Business for Home Assistant Backups.

Backup encryption is enabled by default and can be disabled as shown in the backup documentation.

Configuration

To add the OneDrive for Business service to your Home Assistant instance, use this My button:

Manual configuration steps

If the above My button doesn’t work, you can also perform the following steps manually:

  • Browse to your Home Assistant instance.

  • Go to Settings > Devices & services.

  • In the bottom right corner, select the Add Integration button.

  • From the list, select OneDrive for Business.

  • Follow the instructions on screen to complete the setup.

Tenant ID

Tenant ID of the Entra ID tenant where the account to be used with the integration lives.

Client ID

Application ID of the app registration to be used with the integration.

Client secret

Application secret for the app registration.

Folder path

The path of the folder where to store backups.

Options

Options for OneDrive for Business can be set via the user interface, by taking the following steps:

  • Browse to your Home Assistant instance.
  • Go to Settings > Devices & services.
  • If multiple instances of OneDrive for Business are configured, choose the instance you want to configure.
  • Select the integration, then select Configure.

Requested permissions by the integration

The integration will request the following permissions on your OneDrive for the integration to work:

  • Files.ReadWrite.All: Grants the application permission to read and write in any folder of your OneDrive. Unfortunately, unlike the personal OneDrive, OneDrive for Business does not support the Files.ReadWrite.AppFolder permissions, so these are the least possible permissions.
  • offline_access: Grants the application permission to refresh its authentication token without requiring your manual intervention.
  • openid: Grants the application permission to read basic information, for example, if you have a OneDrive.

Getting application credentials

You’ll need to follow this guide by Microsoft on registering an application to create your own client ID and secret.

Make sure to configure the following settings on the app registration:

  • Supported account types: Choose one of Accounts in this organizational directory only (recommended), Accounts in any organizational directory, Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts
  • Redirect URI: Type: Web, URL: https://my.home-assistant.io/redirect/oauth

Sensors

The integration provides the following sensors, which are updated every 5 minutes:

  • Total available storage: The total size of your drive (disabled by default).
  • Used storage: The amount of storage you have used up.
  • Remaining storage: The amount of storage that is left in your drive.
  • Drive state: Calculated state of your drive, based on the storage left. Possible values: Normal, Nearing limit, Critical, Exceeded.

Note

A drive in Drive state Exceeded will be automatically frozen (meaning you can’t upload any more backups & files) until you free up enough storage.

Troubleshooting

Currently we don’t have any known troubleshooting steps, if you find something please create a documentation PR. Thanks!

Removing the integration

This integration follows standard integration removal. No extra steps are required.

To remove an integration instance from Home Assistant

  1. Go to Settings > Devices & services and select the integration card.
  2. From the list of devices, select the integration instance you want to remove.
  3. Next to the entry, select the three dots menu. Then, select Delete.