Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Access the application by DNS name

You now have completed all steps required to test whether your application is accessible from the internet via Application Gateway. You can use the following guidance to perform this task:

Step by step guidance

  1. Check the back-end health of the Application Gateway instance you deployed in the previous task.

    az network application-gateway show-backend-health \
        --name $APPGW_NAME \
        --resource-group $RESOURCE_GROUP
    

    The output of this command should return the Healthy value on the health property of the backendHttpSettingsCollection element. If this is the case, your setup is valid. If you see any other value than healthy, review the previous steps.

    There might be a delay before the Application Gateway reports the Healthy status of backendHttpSettingsCollection, so if you encounter any issues, wait a few minutes and re-run the previous command before you start troubleshooting.

  2. Next, identify the public IP address of the Application Gateway by running the following command from the Git Bash shell.

    az network public-ip show \
        --resource-group $RESOURCE_GROUP \
        --name $APPLICATION_GATEWAY_PUBLIC_IP_NAME \
        --query [ipAddress] \
        --output tsv
    
  3. To identify the custom DNS name associated with the certificate you used to configure the endpoint exposed by the Application Gateway instance, run the following command from the Git Bash shell.

    echo $DNS_NAME
    

    To validate the configuration, you will need to use the custom DNS name to access the public endpoint of the api-gateway app, exposed via the Application Gateway instance. You can test this by adding an entry that maps the DNS name to the IP address you identified in the previous step to the hosts file on your lab computer.

  4. On you lab computer, open the file C:\Windows\System32\drivers\etc\hosts in Notepad using elevated privileges (as administrator) and add an extra line to the file that has the following content (replace the <app-gateway-ip-address> and <custom-dns-name> placeholders with the IP address and the DNS name you identified in the previous two steps):

    <app-gateway-ip-address>   <custom-dns-name>
    
  5. On your lab computer, start a web browser and, in the web browser window navigate to the URL that consists of the https:// prefix followed by the custom DNS name you specified when updating the local hosts file. Your browser may display a warning notifying you that your connection is not private, but this is expected since you are relying on self-signed certificate. Acknowledge the warning but proceed to displaying the target web page. You should be able to see the PetClinic application start page again.

    While the connection to the MySQL database should be working at this point, keep in mind that this connectivity is established via a its public endpoint, rather than the private one. You will remediate this in the next exercise of this lab.