DEV Community

Cover image for Creating DNS Zones and Configuring DNS Settings in Azure: A Step-by-Step Guide
Oladosu Ibrahim
Oladosu Ibrahim

Posted on

Creating DNS Zones and Configuring DNS Settings in Azure: A Step-by-Step Guide

Introduction

Applications often need to communicate using domain names instead of raw IP addresses. Managing these names securely inside your Azure environment is best done with Azure Private DNS, which eliminates the need for a custom DNS solution. With Private DNS zones, you can define custom domain names (like contoso.com) and resolve them directly within your virtual network.

In this guide, you will learn how to create a private DNS zone, link it to a virtual network, and add DNS records that support internal workload communication.

Skilling Objectives

By completing this walkthrough, you will learn how to:

  1. Create and configure a private DNS zone.
  2. Link the DNS zone to a virtual network.
  3. Add DNS records for internal resources.

Architecture Overview

The solution uses:

  1. A private DNS zone named private.contoso.com.
  2. A virtual network link connecting the DNS zone to app-vnet.
  3. A DNS record for the backend subnet to allow name-based resolution of workloads. Image1

This setup ensures that workloads inside app-vnet can communicate using domain names, improving readability and maintainability of the environment.

Step 1: Create a Private DNS Zone

You’ll start by creating a private DNS zone.

  1. In the Azure portal, search for Private DNS zones and select + Create.
    Image2
    Image3

  2. Select your subscription and resource group (for example, RG1).

  3. Enter the zone name private.contoso.com.

  4. Choose a region such as East US.

  5. Select Review + create and then Create.

  6. Once deployment is complete, open the DNS zone resource.
    Image4
    Image5

Step 2: Link the DNS Zone to the Virtual Network

Next, link the DNS zone to your app-vnet so that workloads can resolve records from the zone.

  1. In the portal, open the DNS zone you just created (private.contoso.com).
  2. In the DNS management blade, select + Virtual network links.
  3. Choose + Add to create a new link.
    Image6

  4. Provide a link name such as app-vnet-link.

  5. Select the virtual network app-vnet.

  6. Enable Auto registration to automatically register virtual machine hostnames.

  7. Select Create and wait for deployment to complete.
    Image7

Step 3: Create a DNS Record Set

Now, add a record for the backend subnet.

  1. Open the DNS zone private.contoso.com.
  2. In the DNS management blade, select + Recordsets.
  3. Notice that Azure may have already created A records for your virtual machines.
  4. Select + Add to create a new record set.
  5. Enter the name backend.
  6. Choose record type A.
  7. Set the TTL to 1.
  8. Enter the IP address 10.1.1.5.
  9. Select Add to save the record. Image8

This record means that any workload inside app-vnet can resolve backend.private.contoso.com to the private IP 10.1.1.5.

Conclusion

In this walkthrough, you created a private DNS zone in Azure, linked it to your virtual network, and configured a DNS record for the backend subnet. With this setup, workloads can communicate using domain names instead of IP addresses, while relying on Azure’s built-in DNS service.

This approach reduces complexity, improves readability, and provides a secure way to manage internal name resolution without deploying a custom DNS infrastructure.

Top comments (0)