通过 ARM 创建与 Azure Table 存储的 API 连接
Create an API Connection to an Azure Table Store via ARM
我正在尝试通过 ARM 模板将 API 连接部署到 Table 存储,但下面的模板返回错误 -
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 连接的文档,只有 generic ARM template docs which don't give any examples of which parameterValues
to use, and Table Store connection docs 似乎是针对 REST API 并且没有指定 parameterVaules
ARM 部署需要。
有谁能告诉我使用哪个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": {
"storageaccount": "storageAccount",
"sharedkey": "accountKey"
}
并且 "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": {}
}
接受的答案中的值对我不起作用,但这个确实有效:
"parameterValues": {
"accountName": "[parameters('storageName')]",
"accessKey": "[parameters('storageKey')]"
}
请不要混淆两个不同的场景。
如果您想为 blob 存储部署连接器,您需要在“parameterValues”块中使用这些参数:
"parameterValues": {
"accountName": "[parameters('Template_StorageAccountName')]",
"accessKey": "[parameters('Template_StorageAccountKey')]"
}
如果您要为表存储部署连接器,则需要使用这些参数:
"parameterValues": {
"storageaccount": "[parameters('Template_StorageAccountName')]",
"sharedkey": "[parameters('Template_StorageAccountKey')]"
}
我正在尝试通过 ARM 模板将 API 连接部署到 Table 存储,但下面的模板返回错误 -
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 连接的文档,只有 generic ARM template docs which don't give any examples of which parameterValues
to use, and Table Store connection docs 似乎是针对 REST API 并且没有指定 parameterVaules
ARM 部署需要。
有谁能告诉我使用哪个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": {
"storageaccount": "storageAccount",
"sharedkey": "accountKey"
}
并且 "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": {}
}
接受的答案中的值对我不起作用,但这个确实有效:
"parameterValues": {
"accountName": "[parameters('storageName')]",
"accessKey": "[parameters('storageKey')]"
}
请不要混淆两个不同的场景。
如果您想为 blob 存储部署连接器,您需要在“parameterValues”块中使用这些参数:
"parameterValues": {
"accountName": "[parameters('Template_StorageAccountName')]",
"accessKey": "[parameters('Template_StorageAccountKey')]"
}
如果您要为表存储部署连接器,则需要使用这些参数:
"parameterValues": {
"storageaccount": "[parameters('Template_StorageAccountName')]",
"sharedkey": "[parameters('Template_StorageAccountKey')]"
}