Azure ARM模板部署concat以构造CosmosDB连接字符串

问题描述 投票:0回答:1

我试图模仿为构建存储帐户提供的示例,但它抛出“无法解析语言表达式。预期令牌EndOfData和实际右括号”错误

这是模板https://github.com/fashaikh/functions-aws-s3-cosmosdb-v1/blob/master/azuredeploy.json

"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"

有效,但这不是:

"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', reference(concat('Microsoft.DocumentDb/databaseAccounts/', parameters('databaseAccountName'))).documentEndpoint, ';AccountKey=', listKeys(resourceId('Microsoft.DocumentDb/databaseAccounts', parameters('databaseAccountName')), '2015-04-08').primaryMasterKey)]"

括号似乎是平衡的。我看着https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions-array#concat,无法弄清楚我错过了什么或没看到什么?

我使用deploy.azure.com https://deploy.azure.com/?repository=https://github.com/fashaikh/functions-aws-s3-cosmosdb-v1#/form/setup进行部署,并且模板的预览步骤通过。关于语言表达的东西是不对的

azure azure-resource-manager arm-template
1个回答
0
投票

我将concat的一个片段移动到变量部分,这就是https://github.com/fashaikh/functions-aws-s3-cosmosdb-v1/blob/master/azuredeploy.json#L153

"value": "[concat('AccountName=', variables('accountEndpoint'), ';AccountKey=', listKeys(resourceId('Microsoft.DocumentDb/databaseAccounts', parameters('databaseAccountName')), '2015-04-08').primaryMasterKey)]"
© www.soinside.com 2019 - 2024. All rights reserved.