Introduction
You have a variety of alternatives when it comes to resolving names using DNS. Microsoft Azure DNS is one of such options.
Azure DNS may be configured to resolve host names in your public domain. For example, You may set up Azure DNS to host the contoso.xyz domain and resolve www.contoso.xyz to the IP address of your web server or web app, if you acquired the contoso.xyz domain name from a domain name registrar.
In this section, you will create a test domain and an address record that will resolve www to the IP address 10.10.10.10.
We can achieve this using a graphical method like the Azure portal or a scripting tool like PowerShell.
To begin hosting your domain on Azure DNS, you must first create a DNS zone for that domain.
Then, each DNS record for your domain is created within this DNS zone.
Finally, you must establish the domain's name servers to publish your DNS zone to the Internet.
Each of these processes for both methods is described in detail below.
Creating an Azure DNS zone and record using the Azure portal
Prerequisites
An Azure account having an active subscription.
Steps
Sign in to the Azure portal
Sign in to the Azure portal using your Azure credentials.
Create a DNS zone
A DNS zone holds a domain's DNS records. To begin hosting your domain name in Azure DNS, you must first build a DNS zone for that domain name.
To set up a DNS zone:
-
Select Create a resource in the top left corner, Networking, and DNS zone.
-
Enter or pick the following settings on the Create DNS zone page:
-
Name: For this example, type contoso.xyz. Any value that is not already specified on the Azure DNS servers can be used as the DNS zone name. A domain purchased from a domain name registrar would have a real-world value.
-
Resource group: Select Create new, type MyResourceGroup, and select OK. The name of the resource group must be unique inside the Azure subscription.
- Select Create.
Src: https://docs.microsoft.com/en-us/azure/dns/media/dns-getstarted-portal/openzone650.png
It may take a few minutes to set up the zone.
Create a DNS record
Within the DNS zone, you create DNS entries or records for your domain. To resolve a host name to an IPv4 address, create a new address record or 'A' record.
To make an 'A' record, follow these steps:
-
In the Azure portal's All resources section, open the contoso.xyz DNS zone under the MyResourceGroup resource group. To find it faster, type contoso.xyz into the Filter by name box.
-
Select + Record set at the top of the DNS zone page.
-
Enter or select the following values on the Add record set page:
-
Name: Enter www. The record name is the host name that you wish to resolve to the provided IP address.
-
Type: Select A. Although 'A' records are the most prevalent, other record types exist for mail servers ('MX'), IP v6 addresses ('AAAA'), and so on.
-
TTL: Type 1. The DNS request's time-to-live determines how long DNS servers and clients can cache a response.
-
TTL unit: Select Hours. This is the TTL value's time unit.
- IP address: Enter 10.10.10.10 for this example. This is the IP address to which the record name resolves. In a real-world scenario, you would provide your web server's public IP address.
-
Name: Enter www. The record name is the host name that you wish to resolve to the provided IP address.
Configuring the Azure DNS name servers at a domain name registrar is not necessary because this quickstart example is only for testing purposes. With an actual production domain, you'll want anyone on the Internet to be able to access your web server or app by resolving the host name. You must go to your domain name registrar and change the name server records with the Azure DNS name servers.
Test the name resolution
Now that you have a test DNS zone with a test 'A' record, you can use the tool called nslookup to test the name resolution.
To test DNS name resolution, perform the following steps:
-
Under the All resources section in the Azure portal, open the contoso.xyz DNS zone in the MyResourceGroup resource group. To find it faster, type contoso.xyz into the Filter by name box.
- Copy one of the name server names from the Overview page's name server list.
Src: https://docs.microsoft.com/en-us/azure/dns/media/dns-getstarted-portal/viewzonens500.png
3. Enter the following command into a command prompt
nslookup www.contoso.xyz <name server name>
For instance:
nslookup www.contoso.xyz ns1-08.azure-dns.com
You should see something similar to this:
Src: https://docs.microsoft.com/en-us/azure/dns/media/dns-getstarted-portal/nslookup.png
A command prompt window is shown in the screenshot, with an n s lookup command and values for Server, Address, Name, and Address.
Clean up resources
When you no longer require the resources created in this quickstart, delete the MyResourceGroup resource group. Select Delete resource group from the MyResourceGroup resource group.