Setting up an Azure app

Last updated on
12 August 2025

This guide will show you how to create a app on Azure that can be used to connect your Drupal site to you Microsoft 365 environment.

Creating the app

  1. Visit https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps (login with a account that has the permissions to create a app, preferably a admin account)
  2. Click on "New registration"
  3. Assign a name for the app and select which users can use the API (single tenant, multi tenant, read more about this on https://learn.microsoft.com/en-us/azure/active-directory/develop/single-...)
  4. Enter your redirect URI. To make the module work we need a specific URI for the redirect: https://www.example.com/o365/callback where the example.com part can be changed to the URL of your liking. This step is optional and can be done later on, where you also can enter multiple redirects URI's for the different steps in DTAP.
  5. Click "Register" and you will be shown the app overview page.
     

Creating the app secret key

We need a secret key for the app to work. Follow these steps.

  1. Click "Certificates & secrets" in the left menu bar
  2. Click on "New client secret"
  3. Pick a name and expiry date. The expiry date is a required field that has a max date of now + 2 years)
  4. Click "Add"
  5. Copy the secret value and save for later use.

Make a note of the secret value as this cannot be recovered!

Settings API permissions

To be able to retrieve data from the API we need the app to set some permissions.

  1. Click "API permissions" in the left menu bar
  2. Click "+ Add a permission"
  3. Click "Microsoft Graph" and following "Delegated permissions"
  4. Add checkboxes for (at least) the following permissions
    • email
    • offline_access
    • openid
    • profile
    • User.Read
  5. When you've already enabled some o365 submodules in Drupal you can check if you need more permissions on www.example.com/admin/reports/o365-auth-scopes and enable those as well
  6. Click "Add permissions"

Data needed for Drupal to work

To make the connector work we need some data from the app to be configured in you settings.php (example shown below). We need 

  • The client secret (copy-pasted on step 5 of "Creating the app secret"
  • The client ID (shown on the top of the overview page)
  • The tenant ID (shown on the top of the overview page)
  • The website URL

5.x.x configuration

// Office 365 connector client ID.
$settings['o365']['api_settings']['client_id'] = '<client id>';
// Office 365 connector client secret.
$settings['o365']['api_settings']['client_secret'] = '<client secret>';
// Office 365 connector tenant ID.
$settings['o365']['api_settings']['tenant_id'] = '<tenant id>';

6.x.x configuration

$settings['o365'] = [
  '<connector-1-id>' => [
    'client_id' =>'<client_id>',
    'client_secret' => '<client_secret>',
    'tenant_id' => '<tenant_id>',
  ],
  '<connector-2-id>' => [
    'client_id' =>'<client_id>',
    'client_secret' => '<client_secret>',
    'tenant_id' => '<tenant_id>',
  ],
];

What now?

Now you can start installing and configuring the module: https://www.drupal.org/docs/contributed-modules/office-365-connector/installing-and-configuring-the-module 

Help improve this page

Page status: No known problems

You can: