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.

Map AD role to Mage role

You will need to have created your own application and have app roles in order for this mapping to work.

You can map Active Directory roles to Mage roles by setting the 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.

App roles

When a user signs in for the first time with their Microsoft account, Mage will use this mapping to automatically add the appropriate roles to the user.