通过 ARM 创建到 Azure 表格存储的 API 连接 [英] Create an API Connection to an Azure Table Store via ARM

查看:17
本文介绍了通过 ARM 创建到 Azure 表格存储的 API 连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm attempting to deploy an API Connection to a Table Store via an ARM template, but the template below is returning an error -

输入参数无效.有关详细信息,请参阅详细信息.详细信息:错误代码:ParameterNotDefined.消息:连接上不允许使用参数accountKey",因为它在注册 API 时未定义为连接参数.

Input parameters are invalid. See details for more information. Details:errorCode: ParameterNotDefined. Message: Parameter 'accountKey' is not allowed on the connection since it was not defined as a connection parameter when the API was registered.

我找不到任何特定于通过 ARM 部署此类 API 连接的文档,只有 通用 ARM 模板文档,其中没有给出使用哪个 parameterValues 的任何示例,以及 Table Store 连接文档 似乎是针对 REST API 而没有指定 ARM 部署所需的 parameterVaules.

I cannot find any docs specific to deploying such an API Connection via ARM, only generic ARM template docs which don't give any examples of which parameterValues to use, and Table Store connection docs which seem to be aimed towards the REST API and don't specify the parameterVaules required for ARM deployments.

谁能告诉我使用哪个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": []
        }
    ]
}

推荐答案

parameterValues 应该如下:

The parameterValues should be as following:

"parameterValues": {
          "storageaccount": "storageAccount",
          "sharedkey": "accountKey"
        }

并且 "tableName" 不允许出现在 parameterValues 中.

And "tableName" is not allowed in the parameterValues.

我使用以下 ARM 模板对其进行了测试,它对我来说工作正常.如果您不想使用带有存储帐户密钥的硬代码,您可以使用 ListKeys 函数.

I test it with following ARM template, it works correctly for me. If you don't want to using hard code with storage account key, you could use the ListKeys function in the ARM template.

{
  "$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": {}
}

这篇关于通过 ARM 创建到 Azure 表格存储的 API 连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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