title | description | services | author | ms.service | ms.topic | ms.date | ms.author | ms.custom |
---|---|---|---|---|---|---|---|---|
Delegate a subdomain - Azure PowerShell - Azure DNS |
With this learning path, get started delegating an Azure DNS subdomain using Azure PowerShell. |
dns |
rohinkoul |
dns |
how-to |
05/03/2021 |
rohink |
devx-track-azurepowershell |
You can use Azure PowerShell to delegate a DNS subdomain. For example, if you own the contoso.com domain, you may delegate a subdomain called engineering to another separate zone that you can administer separately from the contoso.com zone.
If you prefer, you can also delegate a subdomain using the Azure portal.
Note
Contoso.com is used as an example throughout this article. Substitute your own domain name for contoso.com.
If you don’t have an Azure subscription, create a free account before you begin.
[!INCLUDE cloud-shell-try-it.md]
To delegate an Azure DNS subdomain, you must first delegate your public domain to Azure DNS. See Delegate a domain to Azure DNS for instructions on how to configure your name servers for delegation. Once your domain is delegated to your Azure DNS zone, you can delegate your subdomain.
First, create the zone for the engineering subdomain.
New-AzDnsZone -ResourceGroupName <resource group name> -Name engineering.contoso.com
Next, note the four name servers for the engineering subdomain.
Get-AzDnsRecordSet -ZoneName engineering.contoso.com -ResourceGroupName <resource group name> -RecordType NS
Create an A record in the engineering zone to use for testing.
New-AzDnsRecordSet -ZoneName engineering.contoso.com -ResourceGroupName <resource group name> -Name www -RecordType A -ttl 3600 -DnsRecords (New-AzDnsRecordConfig -IPv4Address 10.10.10.10)
Next, create a name server (NS) record for the engineering zone in the contoso.com zone.
$Records = @()
$Records += New-AzDnsRecordConfig -Nsdname <name server 1 noted previously>
$Records += New-AzDnsRecordConfig -Nsdname <name server 2 noted previously>
$Records += New-AzDnsRecordConfig -Nsdname <name server 3 noted previously>
$Records += New-AzDnsRecordConfig -Nsdname <name server 4 noted previously>
$RecordSet = New-AzDnsRecordSet -Name engineering -RecordType NS -ResourceGroupName <resource group name> -TTL 3600 -ZoneName contoso.com -DnsRecords $Records
Use nslookup to test the delegation.
-
Open a PowerShell window.
-
At command prompt, type
nslookup www.engineering.contoso.com.
-
You should receive a non-authoritative answer showing the address 10.10.10.10.
Learn how to configure reverse DNS for services hosted in Azure.