Skip to content

Latest commit

 

History

History
101 lines (78 loc) · 3.96 KB

File metadata and controls

101 lines (78 loc) · 3.96 KB

Add origins to an Azure Front Door Origin Group

afd/add-origins-to-origin-group/README.md

Prerequisites

This example assumes you have previously completed the following examples:

  1. Create an Azure Resource Group
  2. Create an Azure Front Door Profile
  3. Create an Azure Front Door Endpoint
  4. Create an Azure Front Door Origin Group
  5. Create an Azure App Service Plan
  6. Deploy a managed JavaSE Spring Boot application
  7. Deploy a managed JavaSE Quarkus application

Add origins to an Azure Front Door Origin Group

We need to get the hostname for the primary application, which is the Spring Boot application we deployed previously. Use the following command line to set the required environment variable:

  export AFD_PRIMARY_HOST_NAME=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_JAVASE_SPRINGBOOT --output tsv --query defaultHostName)

Next we need to add the primary application as an origin to the origin group. Use the commandline below:

  az afd origin create \
    --resource-group $RESOURCE_GROUP \
    --host-name $AFD_PRIMARY_HOST_NAME \
    --profile-name $AFD_PROFILE_NAME \
    --origin-group-name $AFD_ORIGIN_GROUP_NAME \
    --origin-name springboot \
    --origin-host-header $AFD_PRIMARY_HOST_NAME \
    --priority 1 \
    --weight 1000 \
    --enabled-state Enabled \
    --http-port 80 \
    --https-port 443

The next step is to get the hostname for the secondary application, which is the Quarkus application we deployed previously. Use the following command line to set the required environment variable:

  export AFD_SECONDARY_HOST_NAME=$(az webapp show --resource-group $RESOURCE_GROUP --name $APPSERVICE_JAVASE_QUARKUS --output tsv --query defaultHostName)

Next we need to add the secondary application as an origin to the origin group. Use the commandline below:

  az afd origin create \
    --resource-group $RESOURCE_GROUP \
    --host-name $AFD_SECONDARY_HOST_NAME \
    --profile-name $AFD_PROFILE_NAME \
    --origin-group-name $AFD_ORIGIN_GROUP_NAME \
    --origin-host-header $AFD_SECONDARY_HOST_NAME \
    --origin-name quarkus \
    --priority 1 \
    --weight 1000 \
    --enabled-state Enabled \
    --http-port 80 \
    --https-port 443

Cleanup

Do NOT forget to remove the resources once you are done running the example.

3m