Multiple Placement Group Value of NodeType does not match with the value of VMSS

If you’re getting the following error:

Multiple Placement Group Value of NodeType does not match with the value of VMSS

while attempting to deploy a VMSS for a Service Fabric cluster to enable multi-AZ (availability zones) in a region that doesn’t support that (for instance, West Central US; here’s a list of regions that do) then here’s the change you need to make in your template:

{
  "parameters": {
    "azCount": { // usually is either 0 or 3
      "type": "int"
    }
  },
  "variables": {
    "azVar": { // produces [ "1", "2", "3" ]
      "copy": [
        {
          "name": "azCopy",
          "count": "[parameters('azCount')]",
          "input": "[string(copyIndex('azCopy', 1))]"
        }
      ]
    },
    "azEnabled": "[greater(length(variables('azVar').azCopy), 0)]"
  },
  "resources": [
    {
      "name": "myNode",
      "type": "Microsoft.Compute/virtualMachineScaleSets",
      "apiVersion": "2021-07-01",
      "location": "westcentralus",
      "zones": "[if(variables('azEnabled'), variables('azVar').azCopy, json('null'))]",
      "properties": {
        "singlePlacementGroup": "[if(variables('azEnabled'), variables('azEnabled'), json('null'))]",
        "zoneBalance": "[if(variables('azEnabled'), variables('azEnabled'), json('null'))]",
    }
  ]
}

What means that neither of the properties can be set to false despite the ARM template schema for the latest (as of the time of writing) API version mentions it only for zoneBalance and not for singlePlacementGroup.

Unfortunately, none of these docs mention that, yet:

Happy deployment, folks!

This entry was posted in Infrastructure and tagged , , , . Bookmark the permalink.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.