Réseau, zone privée et VM
az group create -n rg-lab-j15 -l francecentral
az network vnet create -g rg-lab-j15 -n vnet-lab-j15 --address-prefixes 10.150.0.0/16 --subnet-name snet-web --subnet-prefixes 10.150.1.0/24
az network nsg create -g rg-lab-j15 -n nsg-lab-web
az network nsg rule create -g rg-lab-j15 --nsg-name nsg-lab-web -n http --priority 100 --access Allow \
--protocol Tcp --destination-port-ranges 80 --source-address-prefixes Internet
az network vnet subnet update -g rg-lab-j15 --vnet-name vnet-lab-j15 -n snet-web --network-security-group nsg-lab-web
az network private-dns zone create -g rg-lab-j15 -n marchal.lab
az network private-dns link vnet create -g rg-lab-j15 -z marchal.lab -n lien-j15 --virtual-network vnet-lab-j15 --registration-enabled true
for N in 1 2; do
az vm create -g rg-lab-j15 -n vm-web-$N --image Ubuntu2204 --size Standard_B1s --zone $N \
--vnet-name vnet-lab-j15 --subnet snet-web --public-ip-address "" --nsg "" \
--admin-username marchal --generate-ssh-keys --custom-data web-cloud-init.yaml
done
az network private-dns record-set a list -g rg-lab-j15 -z marchal.lab -o table
az vm run-command invoke -g rg-lab-j15 -n vm-web-1 --command-id RunShellScript --scripts "getent hosts vm-web-2.marchal.lab"
- Les enregistrements
vm-web-1 et vm-web-2 sont apparus sans action : c'est l'inscription automatique. La résolution renvoie 10.150.1.5 (ou .4).
Cette leçon est réservée aux abonnés
Accédez à l'ensemble des cours, vidéos, ateliers, corrections et au certificat pour 29 € par mois sans engagement, ou 199 € par an.
Créer un compte
J'ai déjà un compte