Quickstart: Create a Front Door for a highly available global web application using Azure CLI

Get started with Azure Front Door by using Azure CLI to create a highly available and high-performance global web application.

The Front Door directs web traffic to specific resources in a backend pool. You defined the frontend domain, add resources to a backend pool, and create a routing rule. This article uses a simple configuration of one backend pool with two web app resources and a single routing rule using default path matching "/*".

Diagram of Front Door deployment environment using the Azure CLI.


  • An Azure account with an active subscription. Create an account for free.
  • Azure CLI installed locally or Azure Cloud Shell
  • Ensure that the front-door extension is added to your Azure CLI
az extension add --name front-door

Use Azure Cloud Shell

Azure hosts Azure Cloud Shell, an interactive shell environment that you can use through your browser. You can use either Bash or PowerShell with Cloud Shell to work with Azure services. You can use the Cloud Shell preinstalled commands to run the code in this article without having to install anything on your local environment.

To start Azure Cloud Shell:

Option Example/Link
Select Try It in the upper-right corner of a code block. Selecting Try It doesn't automatically copy the code to Cloud Shell. Example of Try It for Azure Cloud Shell
Go to https://shell.azure.com, or select the Launch Cloud Shell button to open Cloud Shell in your browser. Launch Cloud Shell in a new window
Select the Cloud Shell button on the menu bar at the upper right in the Azure portal. Cloud Shell button in the Azure portal

To run the code in this article in Azure Cloud Shell:

  1. Start Cloud Shell.

  2. Select the Copy button on a code block to copy the code.

  3. Paste the code into the Cloud Shell session by selecting Ctrl+Shift+V on Windows and Linux or by selecting Cmd+Shift+V on macOS.

  4. Select Enter to run the code.

If you choose to install and use the CLI locally, this quickstart requires Azure CLI version 2.0.28 or later. To find the version, run az --version. If you need to install or upgrade, see Install the Azure CLI.

Create a resource group

In Azure, you allocate related resources to a resource group. You can either use an existing resource group or create a new one.

For this quickstart, you need two resource groups. One in Central US and the second in South Central US.

Create a resource group with az group create:

az group create \
    --name myRGFDCentral \
    --location centralus

az group create \
    --name myRGFDEast \
    --location eastus

Create two instances of a web app

Two instances of a web application that run in different Azure regions is required for this quickstart. Both the web application instances run in Active/Active mode, so either one can service traffic.

If you don't already have a web app, use the following script to set up two example web apps.

Create app service plans

Before you can create the web apps you will need two app service plans, one in Central US and the second in East US.

Create app service plans with az appservice plan create:

az appservice plan create \
--name myAppServicePlanCentralUS \
--resource-group myRGFDCentral

az appservice plan create \
--name myAppServicePlanEastUS \
--resource-group myRGFDEast

Create web apps

Running the following commands will create a web app in each of the app service plans in the previous step. Web app names have to be globally unique.

Create web app with az webapp create:

az webapp create \
--name WebAppContoso-1 \
--resource-group myRGFDCentral \
--plan myAppServicePlanCentralUS 

az webapp create \
--name WebAppContoso-2 \
--resource-group myRGFDEast \
--plan myAppServicePlanEastUS

Make note of the default host name of each web app so you can define the backend addresses when you deploy the Front Door in the next step.

Create the Front Door

Create a basic Front Door with default load balancing settings, health probe, and routing rules by running to follow:

Create Front Door with az network front-door create:

az network front-door create \
--resource-group myRGFDCentral \
--name contoso-frontend \
--accepted-protocols http https \
--backend-address webappcontoso-1.azurewebsites.net webappcontoso-2.azurewebsites.net 

--resource-group: Specify a resource group where you want to deploy the Front Door.

--name: Specify a globally unique name for your Azure Front Door.

--accepted-protocols: Accepted values are http and https. If you want to use both, specific both separated by a space.

--backend-address: Define both web apps host name here separated by a space.

Once the deployment has successfully completed, make note of the host name in the frontEndpoints section.

Test the Front Door

Open a web browser and enter the hostname obtain from the commands. The Front Door will direct your request to one of the backend resources.

Front Door testing page

Clean up resources

When you no longer need the resources that you created with the Front Door, delete both resource groups. When you delete the resource group, you also delete the Front Door and all its related resources.

To delete the resource group use az group delete:

az group delete \
--name myRGFDCentral 

az group delete \
--name myRGFDEast

Next steps

In this quickstart, you created a:

  • Front Door
  • Two web apps

To learn how to add a custom domain to your Front Door, continue to the Front Door tutorials.