azure - Azure VM 规模集中的部署代理

标签 azure azure-devops azure-virtual-machine continuous-deployment azure-vm-scale-set

我目前正在使用 ARM 模板部署 VM 规模集 (VMSS),该模板在 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 扩展,这样您就可以即时计算所有内容。

关于azure - Azure VM 规模集中的部署代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53535539/

相关文章:

Azure虚拟机: Adding a Reserved IP address to an existing VM

c# - Azure Function .net core 6 隔离-traceparent (W3C) 关联

azure - 如何从 Azure Key Vault 中的证书动态获取 ARM 模板中的证书指纹?

Azure DevOps 发布管道 Azure CLI Powershell 任务找不到 powershell

reactjs - 如何为应用服务上使用 azure devops 管道部署的 React 应用设置 .env

azure - 将 Azure Web App Files 文件夹装载到 VM 中?

Azure SQL 数据仓库 JDBC 连接

python - Azure 中与 Aws SqS 最相似的队列服务是什么?

tfs - 从 Visual Studio Online 导出数据

azure - 在Azure App Service上部署多个Web应用程序..这有什么影响吗