部署ARM模板时出现内部服务器错误 [英] Internal server error when deploying ARM Template

查看:87
本文介绍了部署ARM模板时出现内部服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在部署一个包含以下资源的手臂模板

I am deploying an arm template that contains the following resources

Microsoft.Storage/storageAccount
Microsoft.Sql/servers
Microsoft.Sql/servers/auditPolicies

现在一切正常,直到我开始更改auditPolicies对象的值.这是在InternalServerError发生之前我采取的步骤.

Now everything worked until I started changing the values for the auditPolicies object. Here are the steps I took until the InternalServerError occurred.

  1. 添加了auditState属性,并将其值设置为Disabled.部署成功.
  2. auditState属性更改为Enabled.部署失败.错误指出storageAccountName是必需的.
  3. 添加了storageAccountName,并将其值设置为存储帐户的名称.部署失败.错误指出storageAccountKey.
  4. 添加了storageAccountKey,并将其值设置为存储帐户的keys对象的key1.部署失败.内部服务器错误-保存审核设置时发生错误,请稍后重试".此外,这些错误会导致部署无限期地运行.尽管我并不担心这方面.
  1. Added the auditState property and set its value to Disabled. Deployment Successful.
  2. Changed the auditState property to Enabled. Deployment failed. Error states that the storageAccountName is required.
  3. Added storageAccountName and set its value to the name of the storage account. Deployment failed. Error states that storageAccountKey.
  4. Added storageAccountKey and set its value to key1 of the storage account's keys object. Deployment failed. Internal Server Error - "An Error has occurred while saving Auditing settings, please try again later". Additionally, the errors cause the deployment to run indefinitely. Though I am not concerned about that aspect.

以下是完整的模板.

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",

  "parameters": {
    "app-name-prefix": {
      "type": "string",
      "minLength": 1
    },
    "app-locations": {
      "type": "array",
      "minLength": 1
    },
    "app-friendly-names": {
      "type": "array",
      "minLength": 1
    },
    "db-user-admin-username": {
      "type": "securestring"
    },
    "db-user-admin-password": {
      "type": "securestring"
    },
    "database-audit-enabled": {
      "defaultValue": "Enabled",
      "allowedValues": [
        "Enabled",
        "Disabled"
      ],
      "type": "string"
    },
    "storage-kind": {
      "defaultValue": "BlobStorage",
      "allowedValues": [
        "StorageV2",
        "BlobStorage"
      ],
      "type": "string"
    },
    "storage-sku": {
      "defaultValue": "Standard_LRS",
      "allowedValues": [
        "Standard_LRS",
        "Standard_ZRS",
        "Standard_GRS",
        "Standard_RAGRS",
        "Premium_LRS"
      ],
      "type": "string"
    }
  },
  "variables": {
    "db-service-name": "[concat(parameters('app-name-prefix'), '-database-service-')]",
    "storage-name": "[concat(toLower(parameters('app-name-prefix')), 'auditstorage')]"
  },
  "resources": [
    {
      "name": "[concat(variables('storage-name'), parameters('app-friendly-names')[copyIndex()])]",
      "type": "Microsoft.Storage/storageAccounts",
      "sku": {
        "name": "[parameters('storage-sku')]"
      },
      "kind": "[parameters('storage-kind')]",
      "apiVersion": "2018-02-01",
      "location": "[parameters('app-locations')[copyIndex()]]",
      "copy": {
        "count": "[length(parameters('app-locations'))]",
        "name": "storageCopy"
      },
      "properties": {
        "supportsHttpsTrafficOnly": true,
        "accessTier": "Hot",
        "encryption": {
          "services": {
            "blob": {
              "enabled": true
            },
            "file": {
              "enabled": true
            }
          },
          "keySource": "Microsoft.Storage"
        }
      }
    },
    {
      "type": "Microsoft.Sql/servers",
      "name": "[concat(variables('db-service-name'), parameters('app-friendly-names')[copyIndex()])]",
      "apiVersion": "2014-04-01",
      "location": "[parameters('app-locations')[copyIndex()]]",
      "copy": {
        "name": "databaseServiceCopy",
        "count": "[length(parameters('app-locations'))]"
      },
      "properties": {
        "administratorLogin": "[parameters('db-user-admin-username')]",
        "administratorLoginPassword": "[parameters('db-user-admin-password')]",
        "version": "12.0"
      },
      "resources": [
        {
          "type": "auditingPolicies",
          "name": "Default",
          "apiVersion": "2014-04-01",
          "location": "[parameters('app-locations')[copyIndex()]]",
          "properties": {
            "auditingState": "[parameters('database-audit-enabled')]",
            "storageAccountName": "[concat(variables('storage-name'), parameters('app-friendly-names')[copyIndex()])]",
            "storageAccountKey": "[listKeys(concat(variables('storage-name'), parameters('app-friendly-names')[copyIndex()]), '2018-02-01').keys[0].value]"
          },
          "dependsOn": [
            "[resourceId('Microsoft.Sql/servers', concat(variables('db-service-name'), parameters('app-friendly-names')[copyIndex()]))]",
            "storageCopy"
          ]
        }
      ]
    }
  ]
}

我缺少什么可以帮助解决此问题?我该怎么做才能阻止此内部服务器错误?

What am I missing that will help resolve this issue? What do I need to do to stop this internal server error?

我已经按照@Pete的要求添加了完整的模板

I have added the complete template as was requested by @Pete

推荐答案

与Azure支持连接后,我找到了答案.

I have found the answer after connecting with Azure Support.

不再支持资源类型:Microsoft.Sql/servers/auditingPolicies,并且在接下来的几周内,Azure资源管理器将不再完全支持此资源.

The resource type: Microsoft.Sql/servers/auditingPolicies is no longer supported and in the next few weeks Azure Resource Manager will no longer support this completely.

此资源类型直接涉及表审核,据报告,表审核已不推荐用于Blob审核.尽管此时文档没有直接报告.所有者将在这篇文章发布后的几天内对文档进行更新.

This resource type refers directly to table auditing, which has been reported as being deprecated for blob auditing. Though the documentation at this time does not directly report it. The docs will be updated in the coming days after this post, by the owners.

要启用审核,您需要使用Microsoft.Sql/servers/auditingSettings对象.有关此内容的文档将要发布,直到您找到为止,然后直接转到该资源类型Microsoft.Sql/servers/databases/auditingSettings的数据库版本的文档.

To enable the auditing you need to use the Microsoft.Sql/servers/auditingSettings object. The documentation on this is coming and until it does you will be directed to documentation for the database version of this resource type Microsoft.Sql/servers/databases/auditingSettings.

审核设置的工作方式与自动调整"顾问程序非常相似.您可以设置服务器或数据库级别的设置.如果尚未直接配置数据库,则服务器设置将由数据库继承.

Auditing settings work much like the Auto-Tuning advisors. You can set either server or database level settings. The server settings will be inherited by the database if the database has not been configured directly.

这是我使用的auditingSettings对象的示例,而不是上面的auditingPolicies对象.它的嵌套方式完全相同.

This is a sample of the auditingSettings object that I use instead of the auditingPolicies object above. It is nested just the same.

{
  "apiVersion": "2017-03-01-preview",
  "type": "auditingSettings",
  "name": "DefaultAuditingSettings",
  "dependsOn": [
    "[resourceId('Microsoft.Sql/servers', concat(variables('db-service-name'), parameters('app-friendly-names')[copyIndex()]))]",
    "storageCopy"
  ],
  "properties": {
    "state": "Enabled",
    "storageEndpoint": "[reference(concat('Microsoft.Storage/storageAccounts', '/', variables('storage-name'), parameters('app-friendly-names')[copyIndex()]), '2018-02-01').primaryEndpoints.blob]",
    "storageAccountAccessKey": "[listKeys(concat(variables('storage-name'), parameters('app-friendly-names')[copyIndex()]), '2018-02-01').keys[0].value]",
    "storageAccountSubscriptionId": "[subscription().subscriptionId]",
    "isStorageSecondaryKeyInUse": false,
    "retentionDays": "30"
  }
}

这篇关于部署ARM模板时出现内部服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆