Azure逻辑应用程序的ARM模板-SQL创建触发器



是否可以为逻辑应用程序构建手臂模板,该应用程序触发sql中的记录?

我尝试了各种方法,我总是遇到的问题是无法找到连接。

我已经在Azure中创建了连接,并通过使用该连接手动创建逻辑应用程序来证明它有效。

这是我最新的实现(目前为硬编码(:

{
      "type": "Microsoft.Logic/workflows",
      "apiVersion": "2017-07-01",
      "name": "Data-Sync-Scheduler",
      "location": "[parameters('location')]",
      "properties": {
        "state": "Enabled",
        "definition": {
          "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
          "actions": {
            "HTTP": {
              "inputs": {
                "method": "GET",
                "queries": {
                  "scheduleId": "@{triggerBody()?['ScheduleId']}"
                },
                "uri": "<MY URL>"
              },
              "operationOptions": "DisableAsyncPattern",
              "runAfter": {},
              "type": "Http"
            }
          },
          "contentVersion": "1.0.0.0",
          "outputs": {},
          "parameters": {
            "$connections": {
              "defaultValue": {
                "sql": {
                  "connectionId": "/subscriptions/<ID>/resourceGroups/AZJACK001/providers/Microsoft.Web/connections/sql_2",
                  "connectionName": "sql_2",
                  "id": "/subscriptions/<ID>/providers/Microsoft.Web/locations/centralus/managedApis/sql"
                }
              },
              "type": "Object"
            }
          },
          "triggers": {
            "When_an_item_is_created": {
              "inputs": {
                "host": {
                  "connection": {
                    "name": "@parameters('$connections')['sql']['connectionId']"
                  }
                },
                "method": "get",
                "path": "/datasets/default/tables/@{encodeURIComponent(encodeURIComponent('[dbo].[Schedule]'))}/onnewitems"
              },
              "recurrence": {
                "frequency": "Minute",
                "interval": 1
              },
              "splitOn": "@triggerBody()?['value']",
              "type": "ApiConnection"
            }
          }
        }
      }
    }

编辑1:这是一个Azure SQL托管数据库。

我遇到的问题是逻辑应用参数和ARM参数之间的区别,我的解决方案如下:

{
      "type": "Microsoft.Logic/workflows",
      "apiVersion": "2017-07-01",
      "name": "Data-Sync-Scheduler",
      "location": "[parameters('location')]",
      "properties": {
        "state": "Enabled",
        "definition": {
          "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
          "actions": {
            "HTTP": {
              "inputs": {
                "method": "GET",
                "queries": {
                  "scheduleId": "@{triggerBody()?['ScheduleId']}"
                },
                "uri": "<MY URL>"
              },
              "operationOptions": "DisableAsyncPattern",
              "runAfter": {},
              "type": "Http"
            }
          },
          "contentVersion": "1.0.0.0",
          "outputs": {},
          "parameters": {
            "$connections": {
              "defaultValue": {},
              "type": "Object"
            }
          },
          "triggers": {
            "When_an_item_is_created": {
              "inputs": {
                "host": {
                  "connection": {
                    "name": "@parameters('$connections')['sql_2']['connectionId']"
                  }
                },
                "method": "get",
                "path": "/datasets/default/tables/@{encodeURIComponent(encodeURIComponent('[dbo].[Schedule]'))}/onnewitems"
              },
              "recurrence": {
                "frequency": "Minute",
                "interval": 1
              },
              "splitOn": "@triggerBody()?['value']",
              "type": "ApiConnection"
            }
          }
        },
        "parameters": {
          "$connections": {
            "value": {
              "sql_2": {
                "connectionId": "/subscriptions/<MY ID>/resourceGroups/AZJACK001/providers/Microsoft.Web/connections/sql_2",
                "connectionName": "sql_2",
                "id": "/subscriptions/<MY ID>/providers/Microsoft.Web/locations/centralus/managedApis/sql"
              }
            },
            "type": "Object"
          }
        }
      }
    }

相关内容

  • 没有找到相关文章

最新更新