Azure Private DNS:-
az network vnet create --resource-group AZ700RGlod63023440 --name VNET1 --address-prefix 10.10.0.0/16 --subnet-name web --subnet-prefix 10.10.0.0/26 --location eastus
az network private-dns zone create --resource-group AZ700RGlod63023440 --name hexelo.com
Link VNET to private DNS
az network private-dns link vnet create --resource-group AZ700RGlod63023440 --zone-name hexelo.com --name VNET1-link --virtual-network VNET1 --registration-enabled true
network vnet show --resource-group AZ700RGlod63023440 --name VNET1 -o table
az network private-dns link vnet list --resource-group AZ700RGlod63023440 --zone-name hexelo.com -o table
====Create VM’s windows server
VM1:-
az vm create --resource-group AZ700RGlod63023440 --name VM1 --image MicrosoftWindowsServer:WindowsServer:2022-datacenter-azure-edition:latest --size Standard_B2s --admin-username AzureAdmin --admin-password 'Az!63023440!' --vnet-name VNET1 --subnet web --location eastus
VM2:-
az vm create --resource-group AZ700RGlod63023440 --name VM2 --image MicrosoftWindowsServer:WindowsServer:2022-datacenter-azure-edition:latest --size Standard_B2s --admin-username AzureAdmin --admin-password 'Az!63023440!' --vnet-name VNET1 --subnet web --location eastus
az vm show --resource-group AZ700RGlod63023440 --name VM1 --query "name" -o tsv
Get the IP’s
az vm list-ip-addresses --resource-group AZ700RGlod63023440 -o table
Optional :-
az network nic list --resource-group AZ700RGlod63023440 --query "[].{VM:name,Subnet:ipConfigurations[0].subnet.id}" -o table
==== Add record sets to the private DNS zone:-
az network private-dns record-set a create --resource-group AZ700RGlod63023440 --zone-name hexelo.com --name db1 --ttl 10
az network private-dns record-set a create --resource-group AZ700RGlod63023440 --zone-name hexelo.com --name db2 --ttl 10
Optional :- az network private-dns record-set a list --resource-group AZ700RGlod63023440 --zone-name hexelo.com --query "[].name" --output table
Ensure VM1 and VM2 are auto registered as true shown in image.
Check VM1 & VM2.
az network private-dns record-set a show --resource-group AZ700RGlod63023440 --zone-name hexelo.com --name vm1 --query "aRecords[].ipv4Address" -o tsv
az network private-dns record-set a show --resource-group AZ700RGlod63023440 --zone-name hexelo.com --name vm2 --query "aRecords[].ipv4Address" -o tsv
DB1 & DB2 Verify
az network private-dns record-set a show --resource-group AZ700RGlod63023440 --zone-name hexelo.com --name db1 --query "aRecords[].ipv4Address" -o tsv
az network private-dns record-set a show --resource-group AZ700RGlod63023440 --zone-name hexelo.com --name db1 --query "aRecords[].ipv4Address" -o tsv
For all verification:
az network private-dns record-set a list --resource-group AZ700RGlod63023440 --zone-name hexelo.com --query "[].{Name:name,IP:aRecords[].ipv4Address}" -o table
0 Comments