Error :Deployment failed Subnet Subnet_XXX referenced by resource /subscriptions
How to handle cloud deployment errors Azure
Error : Deployment failed Subnet Subnet_varanrg2 referenced by resource /subscriptions
Error on Azure resource group
{"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":"SubnetsNotInSameVnet","message":"Subnet Subnet_varan2rg3 referenced by resource /subscriptions/XXXXXXXXXX/resourceGroups/varan2_rg/providers/Microsoft.Network/networkInterfaces/simpleLinuxVMNetInt/ipConfigurations/ipconfig1 is not in the same Virtual Network /subscriptions/XXXXX/varan2_rg/providers/Microsoft.Network/virtualNetworks/vNet_varanrg1 as the subnets of other VMs in the availability set."}]}
This error occurs when subnet that is used to provision vm is not in same availability set as other subnets in VM.
Resolution : Create availability sets in Azure and add subnet to the vnet.
If it is possible to use a new resource group, then create a new resource group and deploy VM to that resource group.
https://www.servicenow.com/community/itom-articles/error-deployment-failed-subnet-subnet-xxx-referenced-by-resource/ta-p/2322016