Azure 资源管理器模板链接函数

Azure Resource Manager template chained functions

我试图在分配给输出变量值

之前使用 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 function should be the value for 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))]"

换行只是为了便于阅读