Azure VM规模集中的部署代理



我目前正在使用ARM模板部署VM规模集(VMSS(,该模板内部有一个资源,用于安装Azure DevOps(ADO(部署代理的Azure扩展。全部部署成功,并在ADO中注册了一个节点,所有细节都在ARM模板中。然而,问题是它只在第一个节点上安装代理,并且(据我所见(忽略了其余的节点。我在创建缩放集的过程中用多个节点测试了这一点,也用了自动缩放。这两种情况都只会导致第一个代理注册。这是我正在使用的代码布局(我已经删除了VMSS位,以减少这里的模板长度,当然里面有操作系统、存储和网络设置(:

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

当然,现在需要的状态是,所有节点都将安装代理,这样我就可以在发布管道中使用部署组。

您的问题在于,所有代理都具有相同的AgentName,因此它有效地覆盖了代理,并且只有最新的代理"存活"下来。我认为你无能为力,除非你只是修改AgentName,它会根据计算机名称自动分配。

您可以将其转换为script\dsc扩展,这样您就可以实时计算所有内容。

最新更新