|
| 1 | +--- |
| 2 | +title: Create an Azure DNS private zone using the Azure portal |
| 3 | +description: In this tutorial, you create and test a private DNS zone and record in Azure DNS. This is a step-by-step guide to create and manage your first private DNS zone and record using the Azure portal. |
| 4 | +services: dns |
| 5 | +author: vhorne |
| 6 | +ms.service: dns |
| 7 | +ms.topic: tutorial |
| 8 | +ms.date: 6/15/2019 |
| 9 | +ms.author: victorh |
| 10 | +#Customer intent: As an experienced network administrator I want to create an Azure DNS private zone, so I can resolve host names on my private virtual networks. |
| 11 | +--- |
| 12 | + |
| 13 | +# Tutorial: Create an Azure DNS private zone using the Azure portal |
| 14 | + |
| 15 | +This tutorial walks you through the steps to create your first private DNS zone and record using the Azure portal. |
| 16 | + |
| 17 | +[!INCLUDE [private-dns-public-preview-notice](../../includes/private-dns-public-preview-notice.md)] |
| 18 | + |
| 19 | +A DNS zone is used to host the DNS records for a particular domain. To start hosting your domain in Azure DNS, you need to create a DNS zone for that domain name. Each DNS record for your domain is then created inside this DNS zone. To publish a private DNS zone to your virtual network, you specify the list of virtual networks that are allowed to resolve records within the zone. These are called *linked* virtual networks. When autoregistration is enabled, Azure DNS also updates the zone records whenever a virtual machine is created, changes its' IP address, or is deleted. |
| 20 | + |
| 21 | +In this tutorial, you learn how to: |
| 22 | + |
| 23 | +> [!div class="checklist"] |
| 24 | +> * Create a DNS private zone |
| 25 | +> * Create a virtual network |
| 26 | +> * Link the virtual network |
| 27 | +> * Create test virtual machines |
| 28 | +> * Create an additional DNS record |
| 29 | +> * Test the private zone |
| 30 | +
|
| 31 | +If you don’t have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin. |
| 32 | + |
| 33 | +If you prefer, you can complete this tutorial using [Azure PowerShell](private-dns-getstarted-powershell.md) or [Azure CLI](private-dns-getstarted-cli.md). |
| 34 | + |
| 35 | +## Create a DNS private zone |
| 36 | + |
| 37 | +The following example creates a DNS zone called **private.contoso.com** in a resource group called **MyAzureResourceGroup**. |
| 38 | + |
| 39 | +A DNS zone contains the DNS entries for a domain. To start hosting your domain in Azure DNS, you create a DNS zone for that domain name. |
| 40 | + |
| 41 | +1. On the portal page upper left, select **Create a resource**, then **Networking**. Type **Private DNS zone** in the search text box and press **Enter**. |
| 42 | +1. Select **Private DNS zone**. |
| 43 | +2. Select **Create**. |
| 44 | + |
| 45 | +1. On the **Create Private DNS zone** page, type or select the following values: |
| 46 | + |
| 47 | + - **Resource group**: Select **Create new**, enter *MyAzureResourceGroup*, and select **OK**. The resource group name must be unique within the Azure subscription. |
| 48 | + - **Name**: Type *private.contoso.com* for this example. |
| 49 | +1. For **Resource group location**, select **West Central US**. |
| 50 | + |
| 51 | +1. Select **Review + Create**. |
| 52 | + |
| 53 | +1. Select **Create**. |
| 54 | + |
| 55 | +It may take a few minutes to create the zone. |
| 56 | + |
| 57 | +## Create a virtual network |
| 58 | + |
| 59 | +1. On the portal page upper left, select **Create a resource**, then **Networking**, then select **Virtual network**. |
| 60 | +2. For **Name**, type **myAzureVNet**. |
| 61 | +3. For **Resource group**, select **MyAzureResourceGroup**. |
| 62 | +4. For **Location**, select **West Central US**. |
| 63 | +5. Accept the other default values and select **Create**. |
| 64 | + |
| 65 | +## Link the virtual network |
| 66 | + |
| 67 | +To link the private DNS zone to a virtual network, you create a virtual network link. |
| 68 | + |
| 69 | +1. Open the **MyAzureResourceGroup** resource group and select the **private.contoso.com** private zone. |
| 70 | +2. On the left pane, select **Virtual network links**. |
| 71 | +3. Select **Add**. |
| 72 | +4. Type **myLink** for the **Link name**. |
| 73 | +5. For **Virtual network**, select **myAzureVNet**. |
| 74 | +6. Select the **Enable auto registration** check box. |
| 75 | +7. Select **OK**. |
| 76 | + |
| 77 | +## Create the test virtual machines |
| 78 | + |
| 79 | +Now, create two virtual machines so you can test your private DNS zone: |
| 80 | + |
| 81 | +1. On the portal page upper left, select **Create a resource**, and then select **Windows Server 2016 Datacenter**. |
| 82 | +1. Select **MyAzureResourceGroup** for the resource group. |
| 83 | +1. Type **myVM01** - for the name of the virtual machine. |
| 84 | +1. Select **West Central US** for the **Region**. |
| 85 | +1. Type **azureadmin** for the administrator user name. |
| 86 | +2. Type **Azure12345678** for the password and confirm the password. |
| 87 | + |
| 88 | +5. For **Public inbound ports**, select **Allow selected ports**, and then select **RDP (3389)** for **Select inbound ports**. |
| 89 | +10. Accept the other defaults for the page and then click **Next: Disks >**. |
| 90 | +11. Accept the defaults on the **Disks** page, then click **Next: Networking >**. |
| 91 | +1. Make sure that **myAzureVNet** is selected for the virtual network. |
| 92 | +1. Accept the other defaults for the page, and then click **Next: Management >**. |
| 93 | +2. For **Boot diagnostics**, select **Off**, accept the other defaults, and then select **Review + create**. |
| 94 | +1. Review the settings and then click **Create**. |
| 95 | + |
| 96 | +Repeat these steps and create another virtual machine named **myVM02**. |
| 97 | + |
| 98 | +It will take a few minutes for both virtual machines to complete. |
| 99 | + |
| 100 | +## Create an additional DNS record |
| 101 | + |
| 102 | + The following example creates a record with the relative name **db** in the DNS Zone **private.contoso.com**, in resource group **MyAzureResourceGroup**. The fully qualified name of the record set is **db.private.contoso.com**. The record type is "A", with the IP address of **myVM01**. |
| 103 | + |
| 104 | +1. Open the **MyAzureResourceGroup** resource group and select the **private.contoso.com** private zone. |
| 105 | +2. Select **+ Record set**. |
| 106 | +3. For **Name**, type **db**. |
| 107 | +4. For **IP Address**, type the IP address you see for **myVM01**. This should be auto registered when the virtual machine started. |
| 108 | +5. Select **OK**. |
| 109 | + |
| 110 | +## Test the private zone |
| 111 | + |
| 112 | +Now you can test the name resolution for your **private.contoso.com** private zone. |
| 113 | + |
| 114 | +### Configure VMs to allow inbound ICMP |
| 115 | + |
| 116 | +You can use the ping command to test name resolution. So, configure the firewall on both virtual machines to allow inbound ICMP packets. |
| 117 | + |
| 118 | +1. Connect to myVM01, and open a Windows PowerShell window with administrator privileges. |
| 119 | +2. Run the following command: |
| 120 | + |
| 121 | + ```powershell |
| 122 | + New-NetFirewallRule –DisplayName “Allow ICMPv4-In” –Protocol ICMPv4 |
| 123 | + ``` |
| 124 | + |
| 125 | +Repeat for myVM02. |
| 126 | + |
| 127 | +### Ping the VMs by name |
| 128 | + |
| 129 | +1. From the myVM02 Windows PowerShell command prompt, ping myVM01 using the automatically registered host name: |
| 130 | + ``` |
| 131 | + ping myVM01.private.contoso.com |
| 132 | + ``` |
| 133 | + You should see output that looks similar to this: |
| 134 | + ``` |
| 135 | + PS C:\> ping myvm01.private.contoso.com |
| 136 | +
|
| 137 | + Pinging myvm01.private.contoso.com [10.2.0.4] with 32 bytes of data: |
| 138 | + Reply from 10.2.0.4: bytes=32 time<1ms TTL=128 |
| 139 | + Reply from 10.2.0.4: bytes=32 time=1ms TTL=128 |
| 140 | + Reply from 10.2.0.4: bytes=32 time<1ms TTL=128 |
| 141 | + Reply from 10.2.0.4: bytes=32 time<1ms TTL=128 |
| 142 | +
|
| 143 | + Ping statistics for 10.2.0.4: |
| 144 | + Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), |
| 145 | + Approximate round trip times in milli-seconds: |
| 146 | + Minimum = 0ms, Maximum = 1ms, Average = 0ms |
| 147 | + PS C:\> |
| 148 | + ``` |
| 149 | +2. Now ping the **db** name you created previously: |
| 150 | + ``` |
| 151 | + ping db.private.contoso.com |
| 152 | + ``` |
| 153 | + You should see output that looks similar to this: |
| 154 | + ``` |
| 155 | + PS C:\> ping db.private.contoso.com |
| 156 | +
|
| 157 | + Pinging db.private.contoso.com [10.2.0.4] with 32 bytes of data: |
| 158 | + Reply from 10.2.0.4: bytes=32 time<1ms TTL=128 |
| 159 | + Reply from 10.2.0.4: bytes=32 time<1ms TTL=128 |
| 160 | + Reply from 10.2.0.4: bytes=32 time<1ms TTL=128 |
| 161 | + Reply from 10.2.0.4: bytes=32 time<1ms TTL=128 |
| 162 | +
|
| 163 | + Ping statistics for 10.2.0.4: |
| 164 | + Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), |
| 165 | + Approximate round trip times in milli-seconds: |
| 166 | + Minimum = 0ms, Maximum = 0ms, Average = 0ms |
| 167 | + PS C:\> |
| 168 | + ``` |
| 169 | + |
| 170 | +## Delete all resources |
| 171 | + |
| 172 | +When no longer needed, delete the **MyAzureResourceGroup** resource group to delete the resources created in this tutorial. |
| 173 | + |
| 174 | + |
| 175 | +## Next steps |
| 176 | + |
| 177 | +In this tutorial, you deployed a private DNS zone, created a DNS record, and tested the zone. |
| 178 | +Next, you can learn more about private DNS zones. |
| 179 | + |
| 180 | +> [!div class="nextstepaction"] |
| 181 | +> [Using Azure DNS for private domains](private-dns-overview.md) |
0 commit comments