Azure compute resources that are used to create and manage groups of heterogeneous load-balanced virtual machines.
Hello @Mohit Kumar (Capgemini America Inc)
Thanks for the detailed write-up. The error is expected here — let me explain why and give you the exact steps.
Why it happensaz vmss create (and the portal) build a VM scaling profile by default. On a Flexible scale set, any VM profile must reference managed disks — so when the profile is present (even partially, e.g. copied from an older Uniform/unmanaged-disk template with vhdContainers or storageUri), you get:
"...orchestration mode 'Flexible' and a Virtual Machine profile must use managed disks."
For your goal an empty Flex VMSS to attach an existing VM later you don't want a VM profile at all.
Step 1 — Create the empty Flexible VMSS (no scaling profile) Omit all image/OS/admin/SKU parameters. That's what prevents the VM profile (and the error):
az vmss create \
--name myEmptyVmss \
--resource-group myResourceGroup \
--orchestration-mode Flexible \
--platform-fault-domain-count 1
I've set --platform-fault-domain-count 1 deliberately: attaching an existing VM to a scale set with fault domain count = 1 requires no downtime. (For a brand-new empty set with no attach-without-downtime requirement, up to 3 is also valid.)
Step 2 — Attach your existing VM
az vm update \
--resource-group myResourceGroup \
--name myExistingVM \
--set virtualMachineScaleSet.id="/subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.Compute/virtualMachineScaleSets/myEmptyVmss"
Prerequisites for the attach to succeed (these are the common silent blockers):
- Scale set is in Flexible orchestration mode with
singlePlacementGroup = false - VM and scale set are in the same resource group
- VM uses managed disks
- VM is not in an Availability Set or Proximity Placement Group
- Zonality matches — a regional (no-zone) VM attaches to a regional scale set; a zonal VM attaches only to a scale set spanning that same zone
Note: attaching a VM does not automatically wire it to any load balancer. If the VM needs to receive load-balanced traffic, configure its NIC's backend pool manually afterward.
Links :
https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-scaling-profile?tabs=portal#create-a-scale-set-without-a-scaling-profile
https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-attach-detach-vm?tabs=portal-1%2Cportal-2%2Cportal-3
https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-orchestration-modes
Thanks,
Manish.