通过ARM创建与Azure表存储的API连接

Dav*_*ard 2 azure-table-storage azure-rm-template

我正在尝试通过ARM模板将API连接部署到表存储,但下面的模板返回错误 -

输入参数无效.详细信息请参见详细信息.详细信息:errorCode:ParameterNotDefined.消息:连接上不允许参数'accountKey',因为在注册API时未将其定义为连接参数.

我找不到任何专门用于通过ARM部署此类API连接的文档,只提供通用ARM模板文档,这些文档没有提供任何使用的示例parameterValues,以及似乎针对REST API的Table Store连接文档,而不是指定parameterVaulesARM部署所需的内容.

有人能告诉我parameterValues使用哪个?

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "connectionName": {
            "type": "string",
            "defaultValue": "azuretablestest",
            "metadata": {
                "description": "The name of the connection to the Table Store that the Logic App will use."
            }
        },
        "connectionDisplayName": {
            "type": "string",
            "defaultValue": "AzureTablesTest",
            "metadata": {
                "description": "The display name of the connection to the Table Store that the Logic App will use."
            }
        },
        "locationName": {
            "type": "string",
            "defaultValue": "UK South",
            "metadata": {
                "description": "The Azure location to use when creating resources (eg. North Europe)."
            }
        }
    },
    "variables": {},
    "resources": [
        {
            "comments": "Connection to the Table Store that will hold HMLR Business Gateway Service responses.",
            "type": "Microsoft.Web/connections",
            "name": "[parameters('connectionName')]",
            "apiVersion": "2016-06-01",
            "location": "[parameters('locationName')]",
            "scale": null,
            "properties": {
                "displayName": "[parameters('connectionDisplayName')]",
                "customParameterValues": {},
                "parameterValues": {
                    "accountName": "mystorageaccount",
                    "accessKey": "**********",
                    "tableName": "myTableName"
                },
                "api": {
                    "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', replace(toLower(parameters('locationName')), ' ', ''), '/managedApis/azuretables')]"
                }
            },
            "dependsOn": []
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

Tom*_*SFT 6

parameterValues应如下所示:

"parameterValues": {
          "storageaccount": "storageAccount",
          "sharedkey": "accountKey"
        }
Run Code Online (Sandbox Code Playgroud)

而且"tableName"是不允许的parameterValues.

我使用以下ARM模板测试它,它对我来说正常.如果您不想将硬代码与存储帐户密钥一起使用,则可以使用ARM模板中的ListKeys函数.

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "connectionName": {
      "type": "string",
      "defaultValue": "azuretablestest",
      "metadata": {
        "description": "The name of the connection to the Table Store that the Logic App will use."
      }
    },
    "connectionDisplayName": {
      "type": "string",
      "defaultValue": "AzureTablesTest",
      "metadata": {
        "description": "The display name of the connection to the Table Store that the Logic App will use."
      }
    },
    "locationName": {
      "type": "string",
      "defaultValue": "eastus",
      "metadata": {
        "description": "The Azure location to use when creating resources (eg. North Europe)."
      }
    }
  },
  "variables": {},
  "resources": [
    {
      "comments": "Connection to the Table Store that will hold HMLR Business Gateway Service responses.",
      "type": "Microsoft.Web/connections",
      "name": "[parameters('connectionName')]",
      "apiVersion": "2016-06-01",
      "location": "[parameters('locationName')]",
      "scale": null,
      "properties": {
        "displayName": "[parameters('connectionDisplayName')]",
        "customParameterValues": {},
        "parameterValues": {
          "storageaccount": "accountName",
          "sharedkey": "accountKey"
        },
        "api": {
          "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', replace(toLower(parameters('locationName')), ' ', ''), '/managedApis/azuretables')]"
        }
      },
      "dependsOn": []
    }
  ],
  "outputs": {}
}
Run Code Online (Sandbox Code Playgroud)

  • 谢谢,那些参数值完成了这项工作.需要注意的一点是它们区分大小写,因此"storageAccount"和"sharedKey"不起作用. (2认同)