更新虚拟机规模集以添加密钥失败,并显示VHD错误

时间:2016-05-28 22:02:16

标签: azure azure-resource-manager azure-deployment azure-vm-scale-set

我已将虚拟机规模集(VMSS)部署到Azure,作为Service Fabric群集的一部分。当我尝试重新部署模板时,略微增强以使用额外的秘密更新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

1 个答案:

答案 0 :(得分:0)

我已经设法使用PowerShell解决此问题,而不是基于this answer。但我仍然希望找到一种方法让ARM模板部署为现有的VMSS部署添加新证书或其他秘密。

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