Create Virtual Machine in Cloud takes forever in VMM

First a bit of background history. I was at a customer discussing topology and best practices for implementing Logical Networks, Site Definitions and subnets and VLAN’s. The customer had to build VLAN depended networks so the question was why not just create 1 Logical network, 1 Site definition and put all VLAN’s underneath the same site definition. It was just 1 datacenter, 1 hostgroup, so actually no more site definition or Logical networks needed in the opinion of the customer. So as we discussed we created 1 Logical network, 1 Site definition and put all VLAN’s in the site definition. We created a script that accepted pipeline input so the one liner was simple 1..4096 | add-vlannetwork J Sweet, it worked. Just 1 network, 1 site definitions and all VLAN’s underneath it! Also all VM Networks were created. Then we started to connect the azure pack to the VMM Cloud and the first deployment took forever…. What was going on…? Why the create VM in Cloud service takes so long? In the Azure Pack portal I received the error that the VM could not be created after 2-3 minutes. But when I opened the VMM Console I saw that the cloud service was still in a creating state: Just after a couple of minutes (10-15) the job continued and a refresh in Azure Pack portal showed that the VM did create. So actually the error was a false positive. But for a customer a very annoying error as I would have recreated the VM J So what’s happening in creating the Cloud Service that it takes soooo long before starting to deploy the VM. We did see a lot of traffic from SQL Server to VMM Server during this task and decided to look in SQL what it is doing. Soon we found out it was enumerating all VLANs and subnet under 1 Site Definition. Even when we deployed a vm that was not connected to any network we saw this behavior. Ok… First we deleted all VM Networks and left the VLAN’s in the site definitions. Maybe there were too many VMNetworks we thought. Sadly… same result. When we removed all VLAN’s but 1 we found out that it worked! Ok, so here is the next test. Created 2048 Site Definitions and for each 1 created a vlan. And again. It worked. So the conclusion is that you do need to split up Site definitions and vlan and subnets for faster deployment (and no errors in azure pack). Best practices here is to do it by Customer for example if you are a service provider. Or seperate it by datacenter and the vlans you use.