Azure ARM 模板:DocumentDB primaryMasterKey 作为输出
Azure ARM templates : DocumentDB primaryMasterKey as OUTPUT
在 Azure ARM 模板中,我在尝试在 OUTPUT 部分提取在 RESOURCES 部分创建的 DocumentDB 的 'primaryMasterKey' 时遇到一些问题。
部署报告此错误:
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 就像
{"primaryMasterKey":"XXXX","secondaryMasterKey":"XXX","primaryReadonlyMasterKey":"XXX","secondaryReadonlyMasterKey":"XXXX}
好吧,你显然想要一个字符串,而不是一个对象:)
"documentDbPrimaryMasterKey": {
"type": "String", # <<< STRING
"value": "[listKeys(resourceId('Microsoft.DocumentDB/databaseAccounts', variables('documentDb').name), providers('Microsoft.DocumentDB','databaseAccounts').apiVersions[0]).primaryMasterKey]"
}
在 Azure ARM 模板中,我在尝试在 OUTPUT 部分提取在 RESOURCES 部分创建的 DocumentDB 的 'primaryMasterKey' 时遇到一些问题。
部署报告此错误:
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 就像
{"primaryMasterKey":"XXXX","secondaryMasterKey":"XXX","primaryReadonlyMasterKey":"XXX","secondaryReadonlyMasterKey":"XXXX}
好吧,你显然想要一个字符串,而不是一个对象:)
"documentDbPrimaryMasterKey": {
"type": "String", # <<< STRING
"value": "[listKeys(resourceId('Microsoft.DocumentDB/databaseAccounts', variables('documentDb').name), providers('Microsoft.DocumentDB','databaseAccounts').apiVersions[0]).primaryMasterKey]"
}