Skip to content

Commit 2373993

Browse files
authored
Merge pull request #196294 from carlrab/azurecli-docs-azure-front-door
parent file for updated script
2 parents 3034543 + 55d9c77 commit 2373993

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

articles/frontdoor/TOC.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
items:
2424
- name: Resource Manager Templates
2525
href: front-door-quickstart-template-samples.md
26+
- name: Azure CLI
27+
items:
28+
- name: Deploy custom domain
29+
href: scripts/custom-domain.md
2630
- name: Concepts
2731
items :
2832
- name: Front Door manager
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
title: "Azure CLI example: Deploy custom domain in Azure Front Door"
3+
description: Use this Azure CLI example script to deploy a Custom Domain name and TLS certificate on an Azure Front Door front-end.
4+
services: frontdoor
5+
ms.service: frontdoor
6+
ms.custom: devx-track-azurecli
7+
ms.devlang: azurecli
8+
ms.topic: sample
9+
author: DanielLarsenNZ
10+
ms.author: dalars
11+
ms.date: 04/27/2022
12+
---
13+
14+
# Azure Front Door: Deploy custom domain
15+
16+
This Azure CLI script example deploys a custom domain name and TLS certificate on an Azure Front Door front-end. This script demonstrates fully automated provisioning of Azure Front Door with a custom domain name (hosted by Azure DNS) and TLS cert.
17+
18+
> [!IMPORTANT]
19+
> This script requires that an Azure DNS public zone already exists for domain name. For a tutorial, see [Host your domain in Azure DNS](../../dns/dns-delegate-domain-azure-dns.md).
20+
21+
[!INCLUDE [quickstarts-free-trial-note](../../../includes/quickstarts-free-trial-note.md)]
22+
23+
[!INCLUDE [azure-cli-prepare-your-environment.md](../../../includes/azure-cli-prepare-your-environment.md)]
24+
25+
## Sample script
26+
27+
[!INCLUDE [cli-launch-cloud-shell-sign-in.md](../../../includes/cli-launch-cloud-shell-sign-in.md)]
28+
29+
### Getting started
30+
31+
The script will:
32+
33+
1. Create a resource group
34+
1. Create a storage account to host a SPA
35+
1. Enable SPA hosting on storage account
36+
1. Upload a "Hello world!" `index.html` file
37+
1. Create a Front Door profile
38+
1. Create a DNS alias for the Apex that resolves to the Front Door
39+
1. Create a CNAME for the `adverify` hostname
40+
1. Create a Front Door front-end endpoint for the custom domain
41+
1. Add route from custom domain frontend to SPA origin
42+
1. Add a routing rule to redirect HTTP -> HTTPS
43+
1. Enable HTTPS with Front Door managed cert
44+
45+
### Run the script
46+
47+
To run this script, copy the following code to a .sh file, change the hardcoded variables to your domain values, and then execute the following command to pass these variables into the script
48+
49+
```bash
50+
AZURE_DNS_ZONE_NAME=www.contoso.com AZURE_DNS_ZONE_RESOURCE_GROUP=contoso-rg ./deploy-custom-apex-domain.sh
51+
```
52+
53+
:::code language="azurecli" source="~/azure_cli_scripts/azure-front-door/deploy-custom-domain/deploy-custom-domain.sh" id="FullScript":::
54+
55+
## Clean up resources
56+
57+
[!INCLUDE [cli-clean-up-resources.md](../../../includes/cli-clean-up-resources.md)]
58+
59+
```azurecli
60+
az group delete --name $resourceGroup
61+
```
62+
63+
## Sample reference
64+
65+
This script uses the following commands. Each command in the table links to command-specific documentation.
66+
67+
| Command | Description |
68+
|---|---|
69+
| [az group create](/cli/azure/group#az-group-create) | Creates a resource group in which all resources are stored.. |
70+
| [az storage account create](/cli/azure/storage/account) | Creates an Azure Storage account in the specified resource group. |
71+
| [az storage blob service-properties update](/cli/azure/storage/blob/service-properties#az-storage-blob-service-properties-update) | Update storage blob service properties. |
72+
| [az storage blob upload](/cli/azure/storage/blob#az-storage-blob-update) | Sets system properties on the blob. |
73+
| [az storage account show](/cli/azure/storage/account#az-storage-account-show) | Show storage account properties.|
74+
| [az network front-door create](/cli/azure/network/front-door#az-network-front-door-create) | Create a Front Door.|
75+
| [az network dns record-set](/cli/azure/network/dns/record-set) | Manage DNS records and record sets.|
76+
| [az network front-door](/cli/azure/network/front-door) | Manage Front Doors.|
77+
78+
## Next steps
79+
80+
For more information on Azure CLI, see [Azure CLI documentation](/cli/azure).

0 commit comments

Comments
 (0)