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:
- Create the new zone in Azure via the portal or the azure-cli create command.
- Export the newly created zone from Azure to get the new SOA and NS records.
- Open the original zone file to import into Azure.
- Delete the existing SOA and NS records.
- Copy the exported SOA and NS records and paste them into the original zone file.
- Update the SOA serial number. The recommended format is YYYYMMDD1
- Save the changes to the original zone file.
- Use the azure-cli command to import the zone file.
- Go to the Azure Portal and validate that the zone file was imported correctly. A visual inspection of records is highly recommended for thoroughness.
- 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]