Prerequisites
Note - Personal accounts
Since the middle of 2024, Microsoft has mandated that any new app registrations must be created within an Entra ID directory. You will need to sign up for Azure on a pay as you go basis, where Microsoft Entra ID is indicated as always being free.
Getting the client ID and client secret
To allow authentication, you first need to register your application at Entra ID App Registrations:
-
Login at Entra ID Portal (App Registrations). Personal accounts may receive an authentication notification that can be ignored.
-
Create a new App Registration. Give it a name (e.g.,
Home Assistant MS365
).- In Supported account types, choose one of the following as needed by your setup:
Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)
.Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant)
Do not use the following:
Accounts in this organizational directory only (xxxxx only - Single tenant)
Personal Microsoft accounts only
-
Under
Redirect URI (optional)
. ClickSelect a platform
. SelectWeb
. Set Redirect URI tohttps://login.microsoftonline.com/common/oauth2/nativeclient
(https://login.partner.microsoftonline.cn/common/oauth2/nativeclient
for 21Vianet). Leave the other fields blank and click Configure.An alternate method of authentication is available which requires Internet access to your HA instance. The alternate method is simpler to use when authenticating, but is more complex to set up correctly. See Authentication section for more details.
- In Supported account types, choose one of the following as needed by your setup:
-
Click
Register
-
From the Overview page, copy the Application (client) ID.
-
Click
Certificates & secrets
in the Manage section on the left side orAdd a certificate or secret
in the main section. ClickNew client secret
. Give it a Description (e.g., ‘Home Assistant MS365’) and Set the expiration as desired (this appears to be limited to 2 years) and ClickAdd
. Copy the Value of the client secret now (NOT the Secret ID), it will be hidden later on. If you lose track of the secret, return here to generate a new one. -
Click
API permissions
in the Manage section on the left side. ClickAdd a permission
, thenMicrosoft Graph
, thenDelegated permissions
, add the permissions as detailed on the permissions page, and CliickAdd permissions
.