Branch
Branch
BRANCH_RESOURCE_GROUP="rg_sb_eastus_64792_1_173758583281"
BRANCH_LOCATION="westus"
BRANCH_VNET_NAME="BranchVNet"
BRANCH_SUBNET_NAME="BranchSubnet"
BRANCH_VM_NAME="BranchVM"
BRANCH_NSG_NAME="BranchNSG"
# Create the Branch VNet with a non-overlapping IP range (192.168.0.0/16) and one
subnet
az network vnet create \
--resource-group $BRANCH_RESOURCE_GROUP \
--location $BRANCH_LOCATION \
--name $BRANCH_VNET_NAME \
--address-prefixes 192.168.0.0/16 \
--subnet-name $BRANCH_SUBNET_NAME \
--subnet-prefixes 192.168.1.0/24
# Create a VM in the Branch VNet without a public IP, using the default Standard
SSD
az vm create \
--resource-group $BRANCH_RESOURCE_GROUP \
--name $BRANCH_VM_NAME \
--size $VM_SIZE \
--image $IMAGE \
--admin-username $ADMIN_USERNAME \
--admin-password $ADMIN_PASSWORD \
--authentication-type password \
--subnet $BRANCH_SUBNET_NAME \
--vnet-name $BRANCH_VNET_NAME \
--public-ip-address "" \
--location $BRANCH_LOCATION \
--storage-sku StandardSSD_LRS \
--no-wait
# VNet Peering between HeadOffice (East US) and Branch VNet (West US)
az network vnet peering create \
--resource-group rg_sb_eastus_64792_1_173758583281 \
--name HeadOfficeToBranch \
--vnet-name HeadOffice \
--remote-vnet $(az network vnet show --resource-group
rg_sb_eastus_64792_1_173758583281 --name $BRANCH_VNET_NAME --query id -o tsv) \
--allow-vnet-access