⟵ Resources

Connect Directus with Microsoft AD

coding practice

Pre-requisite

  • Dockers, docker network and docker compose.
  • Directus Headless CMS
  • Microsoft AD SSO with OpenID

Microsoft AD Setup

Create an AD application for web.

Add a Redirect URIs in AD application for login callback purpose,

<instance domain>/auth/login/microsoft/callback

(It only allowed http with localhost or https with non-localhost.)

redirect URLS

Create a Client Secrets in AD application, keep the value when secret is generated.

client secret screenshot

Specify the provider in docker-compose.yml file, under environment of directus.

AUTH_PROVIDERS: "microsoft"
AUTH_MICROSOFT_DRIVER: "openid"
AUTH_MICROSOFT_CLIENT_ID: <Application (client) ID>
AUTH_MICROSOFT_CLIENT_SECRET: <Client Secrets generated>
AUTH_MICROSOFT_ISSUER_URL: "https://login.microsoftonline.com/<Directory (tenant) ID>/v2.0/.well-known/openid-configuration"
AUTH_MICROSOFT_SCOPE: <check the well-known metadata endpoint to confirm what scope is supported, usually are "openid profile email">
AUTH_MICROSOFT_IDENTIFIER_KEY: <check the well-known metadata endpoint to confirm what claim is supported, usually is "email">
AUTH_MICROSOFT_ICON: <Fontawesome icon name, e.g. microsoft>
AUTH_MICROSOFT_LABEL: <Button label, it will show "Login with `label`">
AUTH_MICROSOFT_DEFAULT_ROLE_ID: <role_id - Get the role id from URL address when access the role in “Access Control” → “<Role>”>

Restart docker instance, then you shall see the login button,

login button screenshot

References

This article first appeared on Hawjeh Blog.

Step-by-step guide for Sitecore Commerce 9 installation on your machine

Sitefinity PDF Redirection

Best Email Writing Tips for 2025

Portfolios

Resources

Contact Us

Website Development Company in Singapore white logo
LowCarbonSG Logo
Terms & Conditions | Privacy Policy | Accessibility Statement

Apply Now!

Upload Resume (with a 2mb maximum file size)
Accepted file types: doc, docx, pdf, xps, Max. file size: 2 MB.
This field is for validation purposes and should be left unchanged.