Pre-requisites
First, you’ll need to enable user authentication within Mage. You can find out more about this in the Overview page.Enable Microsoft sign in
There are two ways to enable Microsoft sign in. You can either register an application in your organization’s own Microsoft Entra ID, or use the default Mage application. We recommend registering your own application unless there is a specific reason you cannot do so.Register and use your own Mage application
Register and use your own Mage application
Log into your Azure Portal
Click into the Microsoft Entra ID service

Navigate to the tenant you want users to sign into
Click App registrations on the left sidebar

Register a new application for Mage

http(s)://<your-mage-url>/oauth (for Mage open-source)
or https://cluster.mage.ai/<your-cluster-base-path>/oauth?provider=active_directory (for Mage Pro)
or https://<mage-host-url>/oauth?provider=active_directory (for Mage self-hosted).Create client secret for the application


Set environment variable for Mage

Use the default Mage application
Use the default Mage application
Log into your Azure Portal
Click into the Microsoft Entra ID service

Navigate to the directory you want users to sign into
Click 'Properties' in the left sidebar

Copy the value under Tenant ID

Set environment variable for Mage

Configurable environment variables
To configure the environment for Microsoft Azure Cloud and Microsoft Azure Gov Cloud sign-in, you need to set the following environment variables:- You can set the
AZURE_HOSTenvironment variable to one of the following based on your environment:
- You can set the
MICROSOFT_GRAPH_API_HOSTenvironment variable to one of the following basd on your environment:
Map AD role to Mage role
ACTIVE_DIRECTORY_ROLES_MAPPING environment variable.
The value should be a JSON object with the AD role as the key and the name of the Mage role as the value. For example:
export ACTIVE_DIRECTORY_ROLES_MAPPING='{"Mage.Edit": "Editor", "Mage.Admin": "Admin"}'
You can find the AD role value in the App roles section of your application in the Azure Portal.
