2017-03-24 50 views
0

我導出了一個資源組,其中包含一些我想在Visual Studio中使用的Logic應用程序,但是無法使用VS中的designer-view打開一個邏輯應用程序。Azure模板驗證失敗,表達式無效

我得到這個錯誤甚至你我沒有以任何方式修改代碼:

模板驗證失敗:「屬性'表達‘[CONCAT(’@等於(TOLOWER(triggerBody( )'''','parameters'('workflows_Booking_name'),'s']?['Event']),'create')')]' ''Condition _-_ Create_or_UpdateBookings'at line'1'and' 1827'不是有效的模板語言表達。'。

這是邏輯應用程序在門戶中看起來像更好的理解。 enter image description here

+0

看起來模板本身有問題。如果仔細查看錯誤消息,表達式將包含[concat('...')],它看起來像ARM模板表達式,而不是邏輯應用程序定義表達式。你可以在代碼視圖中查看並確認是否是這種情況(並確認原始邏輯應用程序是否相同)? –

+0

你可以分享模板嗎? – juvchan

回答

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": {} 
    } 
    } 

請在Azure的門戶代碼視圖進行比較的代碼視圖中的VS。

enter image description here

enter image description here

那麼就應該準備好視圖在Visual Studio。更多詳細的設計,構建和在Visual Studio中請參閱部署Azure的邏輯應用到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": [] 
     } 
    ] 
}