Skip to main content

On-Prem to Azure DNS Migration

The Azure CLI can easily be used to do this migration. Here's the steps to use the Azure CLI:

  1. Create the new zone in Azure via the portal or the azure-cli create command.
  2. Export the newly created zone from Azure to get the new SOA  and NS records.
  3. Open the original zone file to import into Azure.
  4. Delete the existing SOA and NS records.
  5. Copy the exported SOA and NS records and paste them into the original zone file.
  6. Update the SOA serial number. The recommended format is YYYYMMDD1
  7. Save the changes to the original zone file.
  8. Use the azure-cli command to import the zone file.
  9. Go to the Azure Portal and validate that the zone file was imported correctly. A visual inspection of records is highly recommended for thoroughness.
  10. Once validated, go to the registrar and update the name servers.

The above process can be accomplished through the portal by creating the zone and manually adding each record. Don't forget to update the serial number in the SOA record of the newly created zone.

Azure CLI command to import zone file

Note the zone file must be properly formatted. The first record must be the SOA resource, and the NS records have to match the Azure DNS NS records.

az network dns zone import -g [Azure-Resource-Group] -n [zone_name] -f [imported_zone_file]

Azure CLI command to export zone file from Azure

az network dns zone export -g [Azure-Resource-Group] -n [zone_name] -f [exported_zone_file]