You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: 'Tutorial: Create custom Azure DNS records for a web app'
3
2
description: In this tutorial, you learn how to create custom domain DNS records for web apps using Azure DNS.
4
3
services: dns
5
4
author: asudbring
@@ -22,7 +21,6 @@ To do this, you have to create three records:
22
21
* A root "TXT" record for verification
23
22
* A "CNAME" record for the www name that points to the A record
24
23
25
-
26
24
In this tutorial, you learn how to:
27
25
28
26
> [!div class="checklist"]
@@ -42,18 +40,23 @@ If you don’t have an Azure subscription, create a [free account](https://azure
42
40
43
41
* A web app. If you don't have one, you can [create a static HTML web app](../app-service/quickstart-html.md) for this tutorial.
44
42
45
-
* An Azure DNS zone with delegation in your registrar to Azure DNS. If you don't have one, you can [create a DNS zone](./dns-getstarted-powershell.md), then [delegate your domain](dns-delegate-domain-azure-dns.md#delegate-the-domain) to Azure DNS.
43
+
* An Azure DNS zone with delegation in your registrar to Azure DNS. If you don't have one, you can create a DNS zone, then [delegate your domain](dns-delegate-domain-azure-dns.md#delegate-the-domain) to Azure DNS.
46
44
47
-
> [!NOTE]
48
-
> In this tutorial, `contoso.com` is used as an example domain name. Replace `contoso.com` with your own domain name.
If you're running PowerShell locally, you also need the Azure PowerShell module. Run `Get-Module -ListAvailable Az` to find the version. If you need to upgrade, see [Install Azure PowerShell module](/powershell/azure/install-azure-powershell). If you're running PowerShell locally, you also need to run `Connect-AzAccount` to create a connection with Azure.
53
54
54
-
## Sign in to Azure
55
+
#[Azure CLI](#tab/azure-cli)
55
56
56
-
Sign in to the [Azure portal](https://portal.azure.com).
-DnsRecords (New-AzDnsRecordConfig -IPv4Address "<ip of web app service>")
90
+
$recordParams = @{
91
+
Name = "@"
92
+
RecordType = "A"
93
+
ZoneName = "contoso.com"
94
+
ResourceGroupName = "test-rg"
95
+
Ttl = 600
96
+
DnsRecords = (New-AzDnsRecordConfig -IPv4Address "<ip of web app service>")
97
+
}
98
+
New-AzDnsRecordSet @recordParams
99
+
```
100
+
101
+
# [Azure CLI](#tab/azure-cli)
102
+
103
+
To create the A record, use:
104
+
105
+
```azurecli
106
+
# Create the A record set
107
+
az network dns record-set a create \
108
+
--resource-group test-rg \
109
+
--zone-name contoso.com \
110
+
--name "@" \
111
+
--ttl 600
112
+
113
+
# Add the IP address to the A record set
114
+
az network dns record-set a add-record \
115
+
--resource-group test-rg \
116
+
--zone-name contoso.com \
117
+
--record-set-name "@" \
118
+
--ipv4-address "<ip of web app service>"
76
119
```
77
120
121
+
---
122
+
78
123
> [!IMPORTANT]
79
124
> The A record must be manually updated if the underlying IP address for the web app changes.
80
125
@@ -85,22 +130,76 @@ App Services uses this record only at configuration time to verify that you own
85
130
> [!NOTE]
86
131
> If you want to verify the domain name, but not route production traffic to the web app, you only need to specify the TXT record for the verification step. Verification does not require an A or CNAME record in addition to the TXT record.
87
132
133
+
# [Azure portal](#tab/azure-portal)
134
+
135
+
1. Navigate to your DNS zone in the Azure portal.
136
+
2. Select **+ Record set**.
137
+
3. On the **Add record set** page, enter the following information:
138
+
-**Name**: Enter **@** (represents the root domain)
139
+
-**Type**: Select **TXT**
140
+
-**TTL**: Enter **600**
141
+
-**TTL unit**: Select **Seconds**
142
+
-**Value**: Enter your web app's default domain name (for example, **contoso.azurewebsites.net**)
If your domain is already managed by Azure DNS (see [DNS domain delegation](dns-domain-delegation.md)), you can use the following example to create a CNAME record for contoso.azurewebsites.net. The CNAME created in this example has a "time to live" of 600 seconds in DNS zone named "contoso.com" with the alias for the web app contoso.azurewebsites.net.
99
178
179
+
# [Azure portal](#tab/azure-portal)
180
+
181
+
1. Navigate to your DNS zone in the Azure portal.
182
+
2. Select **+ Record set**.
183
+
3. On the **Add record set** page, enter the following information:
184
+
-**Name**: Enter **www**
185
+
-**Type**: Select **CNAME**
186
+
-**TTL**: Enter **600**
187
+
-**TTL unit**: Select **Seconds**
188
+
-**Alias**: Enter your web app's default domain name (for example, **contoso.azurewebsites.net**)
0 commit comments