Your mental model is pretty close, but a few important nuances about how Azure actually distributes VMs across update domains (UDs) and fault domains (FDs) will clear up the remaining confusion.
First, Azure treats update domains and fault domains as two independent axes of placement. When you deploy a VM into an availability set, Azure assigns it exactly one fault domain and one update domain. The assignment is automatic and done at creation time. You do not control the specific numbers, only the maximum counts defined on the availability set.
With an availability set configured for 3 fault domains and 20 update domains, Azure will try to spread VMs as evenly as possible across both dimensions, but fault domains take priority from a resiliency perspective. This is because fault domains represent physical isolation (power, network, rack), whereas update domains are a logical construct used only during planned maintenance.
So in your scenario with 20 VMs, each VM will indeed land in a distinct update domain, because you have exactly 20 UDs. However, those 20 VMs must still be mapped onto only 3 fault domains. Azure will distribute them as evenly as possible across the 3 FDs. In practice, that means something very close to what you described: roughly one third of the VMs per fault domain, for example 7 in FD0, 7 in FD1, and 6 in FD2. Each of those VMs still has its own unique update domain number. There is no requirement that update domains and fault domains “line up” in a grid-like way - Azure simply assigns both independently.
When you go beyond 20 VMs, the 21st VM will reuse an update domain number, but not arbitrarily. Azure again tries to balance the load, so the reused update domain will typically be paired with a fault domain that keeps overall distribution as even as possible. You should not assume that “VM 21 goes to UD1 and FD1” - the platform’s goal is balance, not strict modulo arithmetic.
Regarding the resiliency concerns, reusing update domains and fault domains does not inherently put your infrastructure at risk, as long as you understand what each domain protects you from. Fault domains protect you from unplanned physical failures. With 3 fault domains, you are protected against the loss of an entire rack or power unit, but you are not protected from losing more than one third of your VMs in a single physical failure. That limitation exists regardless of whether you deploy 3 VMs or 300 VMs into the availability set. Adding more VMs does not reduce fault-domain resilience; it just means more VMs share the same physical isolation boundary.
Update domains protect you from planned maintenance. During planned maintenance, Azure updates one update domain at a time, so only the VMs in that domain are rebooted simultaneously. If you have more VMs than update domains, then yes, multiple VMs will reboot together during maintenance. However, this is expected and accounted for in availability set design. The SLA assumes that your application can tolerate losing all VMs in a single update domain at once. If you exceed the number of update domains, you must design your application tier so that losing one update domain that contains multiple VMs is still acceptable.
The key planning takeaway is that availability sets are meant to protect application tiers, not individual VMs. You plan resiliency by ensuring that each tier has enough instances such that losing one fault domain or one update domain does not take the service down. If you need stronger guarantees, such as isolation across datacenters or protection against zone-level failures, availability sets are no longer sufficient and you should use availability zones instead.
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin