Azure模板验证失败,表达式无效

时间:2017-03-24 15:16:52

标签: azure azure-logic-apps azure-resource-manager

我导出了一个资源组,其中包含一些我想在Visual Studio中使用的Logic应用程序,但是无法使用VS中的designer-view打开一个Logic App。

即使您没有以任何方式修改代码,我也会收到此错误:

  

模板验证失败:'属性'表达式''[concat('@ equals(toLower(triggerBody()?['',parameters('workflows_Booking_name'),'s']?['Event']) , '创建')')]'   模板操作'Condition _-_ Create_or_UpdateBookings'在第'1行'和第'1827列'不是有效的模板语言表达式。'。

逻辑应用程序在门户网站中的外观可以帮助您更好地理解。 enter image description here

1 个答案:

答案 0 :(得分:0)

正如Szymon Wylezol所说,模板本身似乎有问题。从错误消息中我们知道表达式[concat('@equals(toLower(triggerBody()?['', parameters('workflows_Booking_name'),'s']?['Event']), 'create')')]不正确。有关表达式的更多详细信息,请参阅document

根据您提供的截图,我们可以在代码视图中获取以下表达式:

"actions": {
    "Condition_-_Create_or_UpdateBookings": {
      "type": "If",
      "expression": "@equals(toLower(triggerBody()?['Bookings']?['Event']), 'create')",
      "actions": {},
      "runAfter": {}
    }
  }

请将VS中的代码视图与Azure门户中的代码视图进行比较。

enter image description here

enter image description here

然后它应该准备好在Visual Studio中查看。有关在Visual Studio中设计,构建和部署Azure Logic应用程序的更多详细信息,请参阅document

enter image description here

演示代码。

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "workflows_testlogic_name": {
            "defaultValue": "testlogic",
            "type": "string"
        },
        "workflows_tomtestLogicApp_name": {
            "defaultValue": "tomtestLogicApp",
            "type": "string"
        }
    },
    "variables": {},
    "resources": [
        {
            "comments": "Generalized from resource: '/subscriptions/ed0caab7-c6d4-45e9-9289-c7e5997c9241/resourceGroups/tomtestlogicApp/providers/Microsoft.Logic/workflows/testlogic'.",
            "type": "Microsoft.Logic/workflows",
            "name": "[parameters('workflows_testlogic_name')]",
            "apiVersion": "2016-06-01",
            "location": "eastasia",
            "properties": {
                "state": "Enabled",
                "definition": {
                    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
                    "contentVersion": "1.0.0.0",
                    "parameters": {},
                    "triggers": {
                        "manual": {
                            "type": "Request",
                            "kind": "Http",
                            "inputs": {
                                "schema": {
                                    "properties": {
                                      "event": {
                                        "type": "string",
                                        "value": ""
                                      },
                                        "name": {
                                            "type": "string",
                                            "value": ""
                                        },
                                        "participants": {
                                            "type": "integer",
                                            "value": ""
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "actions": {
                        "Condition": {
                            "actions": {},
                            "runAfter": {},
                            "expression": "@equals(toLower(triggerBody()?['name']), 'test')",
                            "type": "If"
                        }
                    },
                    "outputs": {}
                },
                "parameters": {}
            },
            "dependsOn": []
        },
        {
            "comments": "Generalized from resource: '/subscriptions/ed0caab7-c6d4-45e9-9289-c7e5997c9241/resourceGroups/tomtestlogicApp/providers/Microsoft.Logic/workflows/tomtestLogicApp'.",
            "type": "Microsoft.Logic/workflows",
            "name": "[parameters('workflows_tomtestLogicApp_name')]",
            "apiVersion": "2016-06-01",
            "location": "eastasia",
            "tags": {
                "displayName": "LogicApp"
            },
            "properties": {
                "state": "Enabled",
                "definition": {
                    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
                    "contentVersion": "1.0.0.0",
                    "parameters": {},
                    "triggers": {
                        "manual": {
                            "type": "Request",
                            "kind": "Http",
                            "inputs": {
                                "schema": {
                                    "properties": {
                                        "Bookings": {
                                            "properties": {
                                                "BookedByEmail": {
                                                    "type": "string"
                                                },
                                                "Event": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "actions": {
                        "Condition_-_Create_or_UpdateBookings": {
                            "actions": {},
                            "runAfter": {},
                            "expression": "@equals(toLower(triggerBody()?['Bookings']?['Event']), 'create')",
                            "type": "If"
                        }
                    },
                    "outputs": {}
                },
                "parameters": {}
            },
            "dependsOn": []
        }
    ]
}