Add a SAML v2 with Azure AD IdP
On this page
Configure Azure AD (Microsoft Entra ID) as a SAML v2 Identity Provider. FusionAuth acts as the service provider (SP), and Azure AD acts as the Identity Provider (IdP). The FusionAuth login page then shows a Login with Azure AD button that connects to Azure AD users and applications through SAML.

Azure AD is Microsoft Entra ID. But the usage of Azure AD is common. In this document, wherever you see Azure AD, rest assured we mean Microsoft Entra ID as well.
Create an Application in Azure#
This guide uses the SAML single sign-on feature of Azure.
When you already have an Azure AD Enterprise application, skip this section. Otherwise, create an application:
- In the Azure portal, navigate to Enterprise Applications .
- Click New application .
- Click Create your own application .
- Enter a name for the application.
- Select
Integrate any other application you don't find in the gallery (Non-gallery). - Click Create .

Configure Your Azure Application#
On the home screen of your application, click Single sign-on . Then select the SAML option.

Azure AD needs an Entity IDA unique identifier, usually a URL, that names a SAML Identity Provider or Service Provider. The SAML entity Id is unrelated to FusionAuth Entities. from FusionAuth before Azure AD generates an X.509A standard format for public key certificates. certificate. FusionAuth needs an X.509 certificate before you can create the Identity Provider that supplies the Entity ID. To work around the dependency, follow these steps:
- Import a placeholder X.509 certificate into Key MasterThe FusionAuth subsystem for managing cryptographic keys..
- Create a SAML Identity Provider in FusionAuth with the placeholder certificate.
- Update your Azure AD Enterprise application with values from the new Identity Provider. Azure AD then generates a valid X.509 certificate.
- Update the SAML Identity Provider in FusionAuth with the certificate from Azure AD.
- Complete the integration.
When you already have a valid X.509 certificate, use the certificate in the second step, and skip the placeholder steps.
Import a Placeholder X.509 Certificate#
FusionAuth never uses the placeholder certificate to verify a login, so any valid X.509 certificate works. To generate a placeholder certificate, run the following command:
$ openssl req -x509 -newkey rsa:2048 -nodes -keyout /dev/null -out placeholder.crt -subj "/CN=placeholder" -days 30
The command writes the certificate to placeholder.crt and discards the private key.
Navigate to Settings -> Key Master , click Import Certificate , and paste the contents of placeholder.crt.

After you configure Azure AD, Azure AD gives you the X.509 certificate that signs SAML logins.
Create a SAML v2 Identity Provider#
In the FusionAuth Admin UI, navigate to Settings -> Identity Providers -> Add , and select the SAML V2 Identity Provider.

Complete the following fields:
-
Name: a name that describes the connection, such as
Pied Piper Azure AD. -
IdP endpoint: the Login URL value from your Azure AD application, as shown in the following image.

-
Verification keys: the placeholder certificate that you imported. You replace the placeholder later.
Enable Enable debug logging. FusionAuth then writes debug information to the Event Log. To view the Event Log, navigate to System -> Event Log . Turn off debug logging when you run in production.
For more information about the Event Log, see the Event Logs API and Troubleshooting.
Then click the Applications tab of your SAML v2 Identity Provider, and enable the Identity Provider for the Application.

When you save the Identity Provider, FusionAuth can show a CORS warning. Follow the instructions on the screen. For more information, see CORS Configuration.
Linking Options#
When you link users by email, configure the SAML Identity Provider to find the email claim. Navigate to Settings -> Identity Providers -> Your SAML IdP -> Edit , and click the Options tab. Then enter the claim in the Email claim field.

The location of the email claim can vary in an existing Azure AD application. A default Azure AD application uses the following email claim:
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress
When you aren't sure which claim to use, the Event Log shows the SAML response that Azure sends to FusionAuth.
The SAML response in the Event Log contains the claim. In a default Azure AD application, the email claim is nested:
<AttributeStatement>
<!-- ... -->
<Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress">
<AttributeValue>*your*email*</AttributeValue>
</Attribute>
<!-- ... -->
</AttributeStatement>
Finish Setup of Azure AD Application#
Next, enter the values from the FusionAuth Identity Provider into your Azure AD application.
Navigate to your Azure AD application. Under step one, click the pencil icon to edit the configuration.

Add the Entity ID and Reply URL. To find the values, navigate to Settings -> Identity Providers , and click the magnifying glass in the row of your Identity Provider. The Entity ID is the Issuer value in FusionAuth. Enter the Entity and ACS values from FusionAuth into Azure AD.

Download and Import the X.509 Certificate#
Replace the placeholder certificate with the certificate from Azure AD. On the overview of your SAML application in Azure AD, under step three, download the Certificate (Base64).

Import the certificate into Key Master: Settings -> Key Master -> Import Certificate .
Then add the new certificate to the Identity Provider: Settings -> Identity Providers -> your SAML IdP -> Verification keys . Remove the placeholder certificate from Verification keys, and delete the placeholder certificate from Key Master.
Azure AD can publish more than one signing certificate in the federation metadata of the application, such as during a certificate rollover. Import each signing certificate, and add each one to Verification keys. FusionAuth then verifies a SAML response signed with any of the certificates. For more information, see Rotate Identity Provider Certificates.
Configure the FusionAuth Application Redirect URL#
Configure where FusionAuth sends users after the Azure AD login. The redirect URL can be any URL.
Navigate to Applications -> Your Application -> OAuth . Update the Authorized redirect URLs field, and enable the Authorization Code grantAn OAuth 2.0 grant type in which a client exchanges an authorization code for tokens..

Assign Users#
When your existing Azure AD application already has assigned users, skip this step.
Assign Azure AD users to your Azure AD application. Navigate to Users and groups , click Add user/group , and follow the instructions to add a user.

Complete the Login#
To test the integration, log in to the FusionAuth Admin UI, and navigate to Applications -> Your Application . Choose View , scroll to the OAuth2 & OpenID Connect Integration details section, and copy the Login URL.

Open the Login URL in a new tab. The login page shows the Azure AD button from the beginning of this guide. Click the button, and log in as one of the Azure AD users that you assigned. FusionAuth then sends you to your redirect URLThe URL where the authorization server sends the browser after login, with an authorization code or an error..
When the login fails, review the Event Log at System -> Event Log . For help with an invalid signature error, see Invalid Signature Errors.
Related
Set up user login using Azure AD/Microsoft Entra ID as an OpenID Connect Identity Provider.
Configure SAML v2 for Active Directory Federation Services (ADFS).
Learn how to let users log in to FusionAuth through an external SAML v2 Identity Provider.
Learn how to use FusionAuth as a SAML v2 identity provider for other applications.