Deploying a logic app using ARM templates/powershell

前端 未结 3 690
隐瞒了意图╮
隐瞒了意图╮ 2021-01-15 16:54

How can I Deploy a logic app that calls a SQL DB stored procedure? I\'ve tried the following action.

    \"actions\": {
            \"Execute_stored_procedur         


        
3条回答
  •  离开以前
    2021-01-15 17:43

    Things may have changed in the API since the previous answer was given. Here is what worked for me as of 10/2016. Note: I used parameters (definitions not shown) for many of the variables:

     {
      "type": "Microsoft.Web/connections",
      "apiVersion": "2015-08-01-preview",
      "location": "[parameters('location')]",
      "name": "[variables('sql_conn_name')]",
      "properties": {
        "api": {
          "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/sql')]"
        },
        "displayName": "sql_connection",
        "parameterValues": {
          "server": "[concat(variables('dbserver_unique_name'), '.database.windows.net')]",
          "database": "[parameters('databases_name')]",
          "authType": "windows",
          "username": "[parameters('databases_admin_user')]",
          "password": "[parameters('databases_admin_password')]"
        }
      }
    }, 
    {
      "type": "Microsoft.Logic/workflows",
      "name": "[variables('logic_app_name')]",
      "apiVersion": "2016-06-01",
      "location": "[parameters('location')]",
      "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": {
            "$connections": {
              "defaultValue": { },
              "type": "Object"
            }
          },
          "triggers": {
            "Recurrence": {
              "recurrence": {
                "frequency": "Hour",
                "interval": 1
              },
              "type": "Recurrence"
            }
          },
          "actions": {
            "Execute_stored_procedure": {
              "runAfter": { },
              "type": "ApiConnection",
              "inputs": {
                "body": {
                  "timeoffset": "-4"
                },
                "host": {
                  "api": {
                    "runtimeUrl": "[concat('https://logic-apis-', parameters('location'), '.azure-apim.net/apim/sql')]"
                  },
                  "connection": {
                    "name": "@parameters('$connections')['sql']['connectionId']"
                  }
                },
                "method": "post",
                "path": "/datasets/default/procedures/@{encodeURIComponent(encodeURIComponent('[dbo].[usp_UpdateHourlyOos]'))}"
              }
            }
          },
          "outputs": { }
        },
        "parameters": {
          "$connections": {
            "value": {
              "sql": {
                "connectionId": "[concat(subscription().id, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Web/connections/', variables('sql_conn_name'))]",
                "connectionName": "[variables('sql_conn_name')]",
                "id": "[concat(subscription().id,'/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/sql')]"
              }
            }
          }
        }
      },
      "resources": [ ],
      "dependsOn": [
        "[resourceId('Microsoft.Web/connections', variables('sql_conn_name'))]"
      ]
    }
    

提交回复
热议问题