更新虚拟机规模集以添加机密失败并出现 VHD 错误

Updating a Virtual Machine Scale Set to add a secret fails with VHD error

我已将虚拟机规模集 (VMSS) 作为 Service Fabric 群集的一部分部署到 Azure。当我尝试重新部署模板时,稍微增强以使用额外的秘密更新 VMSS,我收到以下错误。我已经验证我使用的参数都是正确的。

"type": "Microsoft.Compute/virtualMachineScaleSets",
// ...
"osProfile": {
  // ...
  "secrets": [
    {
      "sourceVault": {
        "id": "[parameters('sourceVaultValue')]"
      },
      "vaultCertificates": [
        {
          "certificateStore": "[parameters('certificateStoreValue')]",
          "certificateUrl": "[parameters('certificateUrlValue')]"
        },
        { // ******* ADDED *******
          "certificateStore": "[parameters('certificateStoreValue')]",
          "certificateUrl": "[parameters('sslCertificateUrlValue')]"
        } // ******* ADDED *******
      ]
    }
  ]
}, // ...
New-AzureRmResourceGroupDeployment : 5:46:20 PM - Resource Microsoft.Compute/virtualMachineScaleSets 'Primary' failed with message
'VHD Containers currently being used by any Virtual Machine Scale Set VM instances may not be removed. To remove a VHD Container, all
Virtual Machine Scale Set VM instances using it must first be deleted.'
At D:\myapp\deploy\deploy.ps1:104 char:5
+     New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGr ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.NewAzureResourceGroupDeploymentCommand

基于 ,我已经设法使用 PowerShell 解决了这个问题。但我仍然很想找到一种方法让 ARM 模板部署向现有 VMSS 部署添加新证书或其他机密。

更新: 事实证明,当我复制 ARM 模板时,我修改了存储帐户参数,但 Service Fabric 已配置为使用先前自动生成的名称。