Azure Resource Manager模板链接的功能 [英] Azure Resource Manager template chained functions

查看:48
本文介绍了Azure Resource Manager模板链接的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在分配给输出变量值

"webappStorageUri":{
      "type": "string",
      "value": "[take(reference(resourceId('Microsoft.Storage/storageAccounts', variables('webappStorageName'))).primaryEndpoints.web, length(reference(resourceId('Microsoft.Storage/storageAccounts', variables('webappStorageName'))).primaryEndpoints.web)-1]"
 }

返回的值 length 函数应为错误消息

[error]Deployment template language expression evaluation failed: 'Unable to parse language expression 'take(reference(resourceId('Microsoft.Storage/storageAccounts', variables('webappStorageName'))).primaryEndpoints.web, length(reference(resourceId('Microsoft.Storage/storageAccounts', variables('webappStorageName'))).primaryEndpoints.web)-1': expected token 'RightParenthesis' and actual 'Integer'.'. Please see https://aka.ms/arm-template-expressions for usage details.

推荐答案

我不确定您要实现的目标,但是您的函数在方括号中存在问题,并且您无法通过添加 -1 <来真正减去/code>放在一个随机的位置.

I'm not sure what you are trying to achieve, but your function has issues with brackets, and you cannot really substract by appending -1 in a random place.

"[take(reference(variables('webappStorageName')).primaryEndpoints.web,
    sub(length(reference(variables('webappStorageName')).primaryEndpoints.web), 1))]"

换行符仅出于可读性

这篇关于Azure Resource Manager模板链接的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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