将Azure中的publishingcredentials作为json输出返回

时间:2017-01-12 15:58:59

标签: json azure

**编辑:我以为我在发帖前试过这个,但我猜不是 - 解决方案是:

"listPublishingUsername": { "value": "[list(resourceId('Microsoft.Web/sites/config', variables('websiteName'), 'publishingcredentials'), '2016-08-01').properties.publishingUserName]", "type": "string" },

"listPublishingPassword": {
  "value": "[list(resourceId('Microsoft.Web/sites/config', variables('websiteName'), 'publishingcredentials'), '2016-08-01').properties.publishingPassword]",
  "type": "string"
} 

我试图从Azure JSON部署中获取publishUsername / publishingPassword嵌套值。

使用:

  "outputs": {
"listPublishingCredentials": {
  "value": "[list(resourceId('Microsoft.Web/sites/config', parameters('sites_testdsfsdfsfsfs_name'), 'publishingcredentials'), '2014-06-01')]",
  "type": "object"

我能够获得我在资源门户网站中可以看到的所有值

如果我使用.parameters后缀,我可以将某个级别降低到只有参数,但是如果我尝试使用parameters.publishingPassword(这将是基于资源视图的嵌套值),它会返回错误

"code": "DeploymentOutputEvaluationFailed",
  "target": "listPublishingCredentials",
  "message": "The template output 'listPublishingCredentials' is not valid: Index (zero based) must be greater than or equal to zero and less than the size of the argument list..""

或者是否有任何文档可以解释哪些参数/语法对Microsoft.Web / sites / config等资源有效?

编辑:

  "outputs": {
"listPublishingCredentials": {
  "value": "[list(resourceId('Microsoft.Web/sites/config', parameters('sites_testdsfsdfsfsfs_name'), 'publishingcredentials'), '2016-08-01').properties]",
  "type": "object"
}

作品

  "outputs": {
"listPublishingCredentials": {
  "value": "[list(resourceId('Microsoft.Web/sites/config', parameters('sites_testdsfsdfsfsfs_name'), 'publishingcredentials'), '2016-08-01').properties.publishingPassword]",
  "type": "object"
}

没有按'吨

1 个答案:

答案 0 :(得分:1)

"listPublishingUsername": {
  "value": "[list(resourceId('Microsoft.Web/sites/config', variables('websiteName'), 'publishingcredentials'), '2016-08-01').properties.publishingUserName]",
  "type": "string"
},

"listPublishingPassword": {
  "value": "[list(resourceId('Microsoft.Web/sites/config', variables('websiteName'), 'publishingcredentials'), '2016-08-01').properties.publishingPassword]",
  "type": "string"
}