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'))]",
    }
  ]
}

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

Unfortunately neither of these docs mention that, yet:

Happy deployment, folks!

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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