如何使AzureRM在下次部署时不删除先前配置的Microsoft.Web / sites / config属性?

时间:2018-08-07 13:57:03

标签: azure azure-web-sites continuous-deployment azure-resource-manager azure-powershell

这是当前配置https://management.azure.com/subscriptions/<subid>/resourceGroups/<groupid>/providers/Microsoft.Web/sites/<sitename>/config/logs?api-version=2018-02-01

{
  "id": "/subscriptions/<subid>/resourceGroups/<group>/providers/Microsoft.Web/sites/<sitename>/config/logs",
  "name": "logs",
  "type": "Microsoft.Web/sites/config",
  "location": "West Europe",
  "tags": {
    "displayName": "Website",
  },
  "properties": {
    "applicationLogs": {
      "fileSystem": {
        "level": "Off"
      },
      "azureTableStorage": {
        "level": "Off",
        "sasUrl": null
      },
      "azureBlobStorage": {
        "level": "Verbose",
        "sasUrl": "<here is fully specified sasUrl>",
        "retentionInDays": 0
      }
    },
    // ...

完成此操作是为了配置SasUrl,只有在拥有SA并使用Powershell之后才能完成配置。当New-AzureRmResourceGroupDeployment使用此模板运行时,那些属性(sasUrl和其他属性)将丢失。

{
  "apiVersion": "2016-08-01",
  "name": "[variables('prodWebAppName')]",
  "type": "Microsoft.Web/sites",
  "location": "[parameters('location')]",
  "dependsOn": [
    "[variables('appServicePlanName')]"
  ],
  "tags": {
    "displayName": "Website"
  },
  "properties": {
    "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanName'))]",
    "hostNames": [
      // ...
    ],
    "enabledHostNames": [
      // ..
    ],
    "defaultHostName": "[concat(variables('prodWebAppName'), '.azurewebsites.net')]",
    "siteConfig": {
      "netFrameworkVersion": "v4.6",
      "phpVersion": "Off",
      "alwaysOn": true, 
      "webSocketsEnabled":  true, 
      "appSettings": [
        // ... 
      ],
      "connectionStrings": [
        // ...
      ]
    }
  },
// .. and then slots configuration 

这似乎是因为这些netFrameworkVersion之类的设置也在Microsoft.Web/sites/<sitename>/config下。可能应将其放在单独的json模板中,以专门为此网站或广告位运行。该模板用于一次配置所有环境(AAT,QA,Prod),这使事情变得更加复杂。

另外,您认为在诸如MS在https://docs.microsoft.com/en-us/azure/app-service/web-sites-staged-publishing做广告的App Service插槽中进行质量检查和AAT是否正确?在我看来,这不适用于非简单系统的基于脚本/模板的连续部署/交付。

1 个答案:

答案 0 :(得分:0)

ARM用于将最终状态应用于资源,因此它将ARM模板中的值(空白/空值)应用于资源中的设置。

您不是考虑在事后使用PS创建存储资源并更新设置,而是考虑过在ARM模板和using a reference to it's key using listKeys instead中部署存储帐户吗?