Using Auth0 with Microsoft Azure

Auth0 is as simple to integrate in an application deployed on Microsoft Azure as it is for any other environment. To get started, please see:

Tip: change Auth0 configuration when deploying to Microsoft Azure

You'll need to make some configuration changes when deploying to Microsoft Azure. Auth0 recommends creating one application per environment (e.g. Development, Test, Production). This is because each environment should have and use a different Client Id and Client Secret, as well as the appropriate Callback URL.

For ASP.NET applications, we recommend utilizing Web.config transformations to make configuration changes targeted for each environment. Application settings that appear in the transformed web.config will depend on the build target name used at compilation and deployment.

The following is an example of how you can compile and deploy your application. The example focuses on deploying to Production, but you can use it to create builds in your ASP.NET application targeting your other environments.

This is the base configuration in Web.config:

The following snippet, Web.Release.config, contains the necessary transformations. We want to utilize the Release build and are targeting Production.

If you need to refer to the Client Id, Client Secret or Callback URL, you can do so using the ConfigurationManager class. Below is an example of using the ConfigurationManager within an ASP.NET MVC Razor view.

Running web.config transformations are helpful whether deploying to a Microsoft Azure App Service or a Microsoft Azure Cloud Service.

Use the Web.config Transformation Tester to verify the results of any web.config transformations.