Hey every body,
"New-AzVM" has a strange behaviour (maybe a bug), if you pass vn and subnet as parameters and
the vn exists but the subnet doesn't, it will try try to delete the vn (cascading) and recreate it. This
will fail if you have other VMs in the vnet but will succeed if you have empty subnets deleting all of them (OUCH!).
Steps to reproduce:
- login to portal and create 1 vnet (say vnProd2 ) and 2 subnets (say snProd, snDev)
- login to Azure from powershell (module AZ)
- run the following command:
New-Azvm -Location "northeurope" -ResourceGroupName "rgTest" -virtualnetworkname vnProd2 -SubnetName "snProd101" -Image CentOS -Name linux06
In my head that command should create the new snProd101 since it doesn't exist, and it will, too bad it will recreate the vnet deleting the existent subnets snProd and snDev.