I am trying to migrate VM from one subscription to another subscription. For achieving successful migration I am doing the following steps-
1) Delete the VM and nic from the source subscription, leaving the OS Disk and Data Disk(s)
2) Move the OS Disk and Data Disk(s) from the source subscription to the destination subscription.
3) Use Azure CLI to create the VM in the destination subscription by attaching the OS and data disk(s).
When I use the above method, while creating the VM I get the following error -
az vm create --subscription <subs> -n vm-kaushal-mig-test01 \
--os-type Linux \
--attach-os-disk vm-kaushal-mig-test02_OsDisk \
--attach-data-disks vm-kaushal-mig-test02_DataDisk_0 vm-kaushal-mig-test02_DataDisk_1 \
--size Standard_B2s \
--subnet /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Network/virtualNetwork/vnet/subnets/default \
--public-ip-address ""
It is recommended to use parameter "--public-ip-sku Standard" to create new VM with Standard public IP. Please note that the default public IP used for VM creation will be changed from Basic to Standard in the future.
{
"status": "Failed",
"error": {
"code": "DeploymentFailed",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",
"details": [
{
"code": "BadRequest",
"message": "{\r\n \"error\": {\r\n \"code\": \"InvalidResourceReference\",\r\n \"message\": \"Resource /subscriptions/XX/resourceGroups/XX/providers/Microsoft.Network/virtualNetworks/vnet/subnets/default referenced by resource /subscriptions/XX/resourceGroups/XX/providers/Microsoft.Network/networkInterfaces/vm-kaushal-mig-test01VMNic was not found. Please make sure that the referenced resource exists, and that both resources are in the same region.\",\r\n \"details\": []\r\n }\r\n}"
}
]
}
}
Maybe someone can help with this error and tell me why I am getting this?