from https://www.insidethemicrosoftcloud.com/create-new-vm-on-existing-subnet-with-azure-cli/
If you want to attach a VM to an existing subnet, you need to pass the subnet ID to the –subnet
parameter. Begin by retrieving the ID of the existing subnet and assign to a variable.
In this sample, the subnet is named ‘default’, and represented by the –name
parameter, and SUBNETID
is the name of the variable.
export SUBNETID=$(az network vnet subnet show /
--resource-group 'MyRG' --name default /
--vnet-name 'Existing-VNET' --query id -o tsv)