Last active
March 3, 2020 04:23
-
-
Save jesseloudon/963eda087cc7114bfa5760096e976f21 to your computer and use it in GitHub Desktop.
Deploy VNETs with AZCLI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#AuthN | |
az login | |
#Create RG | |
az group create -n "VNET-AZCLI-RG" -l "Australia East" | |
#Create Hub VNET | |
az network vnet create -n "msft-hub-vnet" --address-prefix "10.0.0.0/16" --subnet-name "firewall" --subnet-prefix "10.0.1.0/24" --dns-servers "10.0.2.4" "10.0.2.5" "168.63.129.16" --tags department="Central IT" managedBy="Admins" -g "VNET-AZCLI-RG" | |
az network vnet subnet create -n "ad" --address-prefix "10.0.2.0/24" --vnet-name "msft-hub-vnet" -g "VNET-AZCLI-RG" | |
az network vnet subnet create -n "mgmt" --address-prefix "10.0.3.0/24" --vnet-name "msft-hub-vnet" -g "VNET-AZCLI-RG" | |
az network vnet subnet create -n "GatewaySubnet" --address-prefix "10.0.0.0/27" --vnet-name "msft-hub-vnet" -g "VNET-AZCLI-RG" | |
#Create Spoke VNET | |
az network vnet create -n "msft-spoke1-vnet" --address-prefix "10.1.0.0/16" --subnet-name "web" --subnet-prefix "10.1.1.0/24" --dns-servers "10.0.2.4" "10.0.2.5" "168.63.129.16" --tags department="HR" managedBy="DevOps" -g "VNET-AZCLI-RG" | |
az network vnet subnet create -n "biz" --address-prefix "10.1.2.0/24" --vnet-name "msft-spoke1-vnet" -g "VNET-AZCLI-RG" | |
az network vnet subnet create -n "data" --address-prefix "10.1.3.0/24" --vnet-name "msft-spoke1-vnet" -g "VNET-AZCLI-RG" | |
#Create VNET Peerings | |
az network vnet peering create -g VNET-AZCLI-RG -n msft-hub-vnet-to-msft-spoke1-vnet --vnet-name msft-hub-vnet --remote-vnet msft-spoke1-vnet --allow-vnet-access --allow-forwarded-traffic --allow-gateway-transit | |
az network vnet peering create -g VNET-AZCLI-RG -n msft-spoke1-vnet-to-msft-hub-vnet --vnet-name msft-spoke1-vnet --remote-vnet msft-hub-vnet --allow-vnet-access --allow-forwarded-traffic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment