1
votes

I am currently deploying a VM Scale Set (VMSS) using an ARM template which has a resource inside VMSS to install Azure extension for Azure DevOps (ADO) Deployment Agent. All is deployed successfully and a node is registered in ADO with all details as are in the ARM template. However the problem is that it installs the agent only on first node and (as far as I see) ignores the rest of the nodes. I've tested this with multiple nodes during creation of the scale set and with auto-scale as well. Both scenarios result in only first agent registered. This is the code layout I'm using (I've removed the VMSS bits to reduce the template length here, there are of course OS, storage and network settings inside):

{
  "type": "Microsoft.Compute/virtualMachineScaleSets",
  "name": "[parameters('VMSSName')]",
  "apiVersion": "2018-10-01",
  "location": "[resourceGroup().location]",
  "sku": {
    "name": "[parameters('VMSSSize')]",
    "capacity": "[parameters('VMSSCount')]",
    "tier": "Standard"
  },
  "dependsOn": [],
  "properties": {
    "overprovision": "[variables('overProvision')]",
    "upgradePolicy": {
      "mode": "Automatic"
    },
    "virtualMachineProfile": {},
      "storageProfile": {},
      "networkProfile": {},
      "extensionProfile": {
        "extensions": [
          {
            "type": "Microsoft.Compute/virtualMachineScaleSets/extensions",
            "name": "VMSS-NetworkWatcher",
            "location": "[resourceGroup().location]",
            "properties": {
              "publisher": "Microsoft.Azure.NetworkWatcher",
              "type": "[if(equals(parameters('Platform'), 'Windows'), 'NetworkWatcherAgentWindows', 'NetworkWatcherAgentLinux')]",
              "typeHandlerVersion": "1.4",
              "autoUpgradeMinorVersion": true
            }
          },
          {
            "type": "Microsoft.Compute/virtualMachineScaleSets/extensions",
            "name": "VMSS-TeamServicesAgent",
            "location": "[resourceGroup().location]",
            "properties": {
              "publisher": "Microsoft.VisualStudio.Services",
              "type": "[if(equals(parameters('Platform'), 'Windows'), 'TeamServicesAgent', 'TeamServicesAgentLinux')]",
              "typeHandlerVersion": "1.0",
              "autoUpgradeMinorVersion": true,
              "settings": {
                "VSTSAccountName": "[parameters('VSTSAccountName')]",
                "TeamProject": "[parameters('VSTSTeamProjectName')]",
                "DeploymentGroup": "[parameters('VSTSDeploymentGroupName')]",
                "AgentName": "[concat(parameters('VMSSName'),'-DG')]",
                "Tags": "[parameters('VSTSDeploymentAgentTags')]"
              },
              "protectedSettings": {
                "PATToken": "[parameters('VSTSPATToken')]"
              }
            }
          }
        ]
      }
    }
  }
}

Now the desired state, of course, is that all nodes will have agent installed so that I can use the Deployment Group inside Release pipeline.

1

1 Answers

0
votes

your problem is in the fact that all agents have the same AgentName, so it effectively overwrites the agent and only the latest one "survives". I dont think there is anything you can do, unless you just amend the AgentName and it auto assigns based on computer name.

You can convert this to a script\dsc extension, that way you can calculate everything on the fly.