在分配给输出变量值之前,我正在尝试使用azure函数从URL中删除/
"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
函数返回的值应为take
函数的值。这不起作用。我在部署时遇到以下错误。我没有从这个错误消息中得到任何信息。Azure是否支持链式功能执行?这是从URL中删除/
的正确方法吗?
错误消息
[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
来进行减法。
"[take(reference(variables('webappStorageName')).primaryEndpoints.web,
sub(length(reference(variables('webappStorageName')).primaryEndpoints.web), 1))]"
换行仅用于可读性