Quickstart: Create an Azure DNS zone and record - Azure CLI - Azure DNS (2024)

  • Article

This article walks you through the steps to create your first DNS zone and record using Azure CLI, which is available for Windows, Mac and Linux. You can also perform these steps using the Azure portal or Azure PowerShell.

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. Finally, to publish your DNS zone to the Internet, you need to configure the name servers for the domain. Each of these steps is described below.

Azure DNS also supports private DNS zones. To learn more about private DNS zones, see Using Azure DNS for private domains. For an example on how to create a private DNS zone, see Get started with Azure DNS private zones using CLI.

If you don't have an Azure subscription, create an Azure free account before you begin.

Prerequisites

  • Use the Bash environment in Azure Cloud Shell. For more information, see Quickstart for Bash in Azure Cloud Shell.

    Quickstart: Create an Azure DNS zone and record - Azure CLI - Azure DNS (2)

  • If you prefer to run CLI reference commands locally, install the Azure CLI. If you're running on Windows or macOS, consider running Azure CLI in a Docker container. For more information, see How to run the Azure CLI in a Docker container.

    • If you're using a local installation, sign in to the Azure CLI by using the az login command. To finish the authentication process, follow the steps displayed in your terminal. For other sign-in options, see Sign in with the Azure CLI.

    • When you're prompted, install the Azure CLI extension on first use. For more information about extensions, see Use extensions with the Azure CLI.

    • Run az version to find the version and dependent libraries that are installed. To upgrade to the latest version, run az upgrade.

  • This article requires version 2.0.4 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.

Create the resource group

Before you create the DNS zone, create a resource group to contain the DNS zone:

az group create --name MyResourceGroup --location "East US"

Create a DNS zone

A DNS zone is created using the az network dns zone create command. To see help for this command, type az network dns zone create -h.

The following example creates a DNS zone called contoso.xyz in the resource group MyResourceGroup. Use the example to create a DNS zone, substituting the values for your own.

az network dns zone create -g MyResourceGroup -n contoso.xyz

Create a DNS record

To create a DNS record, use the az network dns record-set [record type] add-record command. For help on A records, see azure network dns record-set A add-record -h.

The following example creates a record with the relative name "www" in the DNS Zone "contoso.xyz" in the resource group "MyResourceGroup". The fully qualified name of the record set is "www.contoso.xyz". The record type is "A", with IP address "10.10.10.10", and a default TTL of 3600 seconds (1 hour).

az network dns record-set a add-record -g MyResourceGroup -z contoso.xyz -n www -a 10.10.10.10

View records

To list the DNS records in your zone, run:

az network dns record-set list -g MyResourceGroup -z contoso.xyz

Test the name resolution

Now that you have a test DNS zone with a test 'A' record, you can test the name resolution with a tool called nslookup.

To test DNS name resolution:

  1. Run the following cmdlet to get the list of name servers for your zone:

    az network dns record-set ns show --resource-group MyResourceGroup --zone-name contoso.xyz --name @
  2. Copy one of the name server names from the output of the previous step.

  3. Open a command prompt, and run the following command:

    nslookup www.contoso.xyz <name server name>

    For example:

    nslookup www.contoso.xyz ns1-08.azure-dns.com.

    You should see something like the following screen:

    Quickstart: Create an Azure DNS zone and record - Azure CLI - Azure DNS (3)

The host name www.contoso.xyz resolves to 10.10.10.10, just as you configured it. This result verifies that name resolution is working correctly.

Clean up resources

When no longer needed, you can delete all resources created in this quickstart by deleting the resource group:

az group delete --name MyResourceGroup

Next steps

Now that you've created your first DNS zone and record using Azure CLI, you can create records for a web app in a custom domain.

Create DNS records for a web app in a custom domain

Quickstart: Create an Azure DNS zone and record - Azure CLI - Azure DNS (2024)
Top Articles
How are miner fees calculated?
How Do You Become A VIP In Binance?
Pollen Count Centreville Va
Ohio Houses With Land for Sale - 1,591 Properties
Design215 Word Pattern Finder
#ridwork guides | fountainpenguin
Booknet.com Contract Marriage 2
Mr Tire Prince Frederick Md 20678
Richard Sambade Obituary
Crime Scene Photos West Memphis Three
Whiskeytown Camera
123 Movies Babylon
Nier Automata Chapter Select Unlock
Raleigh Craigs List
Immortal Ink Waxahachie
Craigslist Panama City Fl
Les Rainwater Auto Sales
London Ups Store
Willam Belli's Husband
Charter Spectrum Store
Craigslist Mt Pleasant Sc
Loves Employee Pay Stub
Craigslist West Valley
A Biomass Pyramid Of An Ecosystem Is Shown.Tertiary ConsumersSecondary ConsumersPrimary ConsumersProducersWhich
Beverage Lyons Funeral Home Obituaries
Gas Buddy Prices Near Me Zip Code
Play Tetris Mind Bender
Trivago Myrtle Beach Hotels
Craigslist List Albuquerque: Your Ultimate Guide to Buying, Selling, and Finding Everything - First Republic Craigslist
Unable to receive sms verification codes
Scott Surratt Salary
Phoenixdabarbie
WPoS's Content - Page 34
Halsted Bus Tracker
Prima Healthcare Columbiana Ohio
THE 10 BEST Yoga Retreats in Konstanz for September 2024
Gold Nugget at the Golden Nugget
Elisabeth Shue breaks silence about her top-secret 'Cobra Kai' appearance
Noaa Duluth Mn
Seminary.churchofjesuschrist.org
Traumasoft Butler
Nina Flowers
Kb Home The Overlook At Medio Creek
Todd Gutner Salary
Gotrax Scooter Error Code E2
Stosh's Kolaches Photos
303-615-0055
Das schönste Comeback des Jahres: Warum die Vengaboys nie wieder gehen dürfen
The Plug Las Vegas Dispensary
Gear Bicycle Sales Butler Pa
The 5 Types of Intimacy Every Healthy Relationship Needs | All Points North
Latest Posts
Article information

Author: Nathanael Baumbach

Last Updated:

Views: 5746

Rating: 4.4 / 5 (75 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Nathanael Baumbach

Birthday: 1998-12-02

Address: Apt. 829 751 Glover View, West Orlando, IN 22436

Phone: +901025288581

Job: Internal IT Coordinator

Hobby: Gunsmithing, Motor sports, Flying, Skiing, Hooping, Lego building, Ice skating

Introduction: My name is Nathanael Baumbach, I am a fantastic, nice, victorious, brave, healthy, cute, glorious person who loves writing and wants to share my knowledge and understanding with you.