Azure ARM模板:DocumentDB primaryMasterKey作为OUTPUT [英] Azure ARM templates : DocumentDB primaryMasterKey as OUTPUT

查看:61
本文介绍了Azure ARM模板:DocumentDB primaryMasterKey作为OUTPUT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Azure ARM模板中,尝试在OUTPUT部分中提取在RESOURCES部分中创建的DocumentDB的"primaryMasterKey"时遇到了一些问题.

In a Azure ARM templates I'm having some problems trying to extract in the OUTPUT section the 'primaryMasterKey' of a DocumentDB created in the RESOURCES section.

部署报告此错误:

模板输出'documentDbPrimaryMasterKey'无效:索引(从零开始)必须大于或等于零且小于参数列表的大小.(代码:DeploymentOutputEvaluationFailed)

The template output 'documentDbPrimaryMasterKey' is not valid: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.. (Code: DeploymentOutputEvaluationFailed)

该输出的定义是:

"documentDbPrimaryMasterKey": {
     "type": "object",
     "value": "[listKeys(resourceId('Microsoft.DocumentDB/databaseAccounts', variables('documentDb').name), providers('Microsoft.DocumentDB','databaseAccounts').apiVersions[0]).primaryMasterKey]"
  }

这是我的模板 https://github.com/toto-castaldi/azure-templates/blob/master/documentdb/template.json

这很奇怪,因为"listKeys"的结果是正确的JSON之类的

It is strange beacuse the result of "listKeys" is a correct JSON like

{"primaryMasterKey":"XXXX","secondaryMasterKey":"XXX","primaryReadonlyMasterKey":"XXX","secondaryReadonlyMasterKey":"XXXX}

推荐答案

好吧,您显然想要一个字符串,而不是一个对象:)

Well, you obviously want a string, not an object :)

"documentDbPrimaryMasterKey": {
    "type": "String", # <<< STRING
    "value": "[listKeys(resourceId('Microsoft.DocumentDB/databaseAccounts', variables('documentDb').name), providers('Microsoft.DocumentDB','databaseAccounts').apiVersions[0]).primaryMasterKey]"
}

这篇关于Azure ARM模板:DocumentDB primaryMasterKey作为OUTPUT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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