使用 DotNet SDK 创建 LogicApp 和 API 连接 ARM 模板

Hit*_*iya 5 azure azure-sdk-.net azure-logic-apps azure-sdk dotnet-sdk

我使用Dot.Net SDK创建了Azure 逻辑应用程序。逻辑应用程序创建成功,但对于触发器和操作,我想使用现有的 Connector。我已手动创建 Azur Portal 的连接器。我正在传递该连接器的 APIConnection 或 Id 来请求 json,但它不会连接到该连接器。我的意思是逻辑应用程序是在没有任何连接器的情况下创建的。

下面是我的请求 Json。


{
    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
    "contentVersion": "1.0.0.0",
    "outputs": {},
    "parameters": {
        "$connections": {
            "defaultValue": {
                "smtp": {
                    "connectionId": "/subscriptions/680cf604-e2e7-4a14-9724-a26c35c573ff/resourceGroups/logicapp_flow_rnd/providers/Microsoft.Web/connections/smtp",
                    "connectionName": "smtp",
                    "id": "/subscriptions/680cf604-e2e7-4a14-9724-a26c35c573ff/providers/Microsoft.Web/locations/westindia/managedApis/smtp"
                },
                "sql": {
                    "connectionId": "/subscriptions/680cf604-e2e7-4a14-9724-a26c35c573ff/resourceGroups/logicapp_flow_rnd/providers/Microsoft.Web/connections/sql",
                    "connectionName": "sql",
                    "id": "/subscriptions/680cf604-e2e7-4a14-9724-a26c35c573ff/providers/Microsoft.Web/locations/westindia/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('LogicAppTable1'))}/onnewitems"
            },
            "recurrence": {
                "frequency": "Minute",
                "interval": 1
            },
            "splitOn": "@triggerBody()?['value']",
            "type": "ApiConnection"
        }
    },
    "actions": {
        "Send_Email": {
            "inputs": {
                "body": {
                    "Body": "New Item Created - @{triggerBody()?['Id']}",
                    "From": "info@logicappdemo.com",
                    "Subject": "LogicAppDemo - New Item Created",
                    "To": "hitesh.vaghasiya@softwebsolutions.com"
                },
                "host": {
                    "connection": {
                        "name": "@parameters('$connections')['smtp']['connectionId']"
                    }
                },
                "method": "post",
                "path": "/SendEmailV2"
            },
            "runAfter": {},
            "type": "ApiConnection"
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这是 Azur 门户的屏幕截图。在这里您可以看到逻辑应用程序已成功创建,但没有连接器。

Azure 门户屏幕截图

请建议,

谢谢

Tom*_*SFT 1

我们还可以使用适用于 Visual Studio 2017 的 Azure 逻辑应用工具在本地设计逻辑应用。使用我们的Azure帐户登录,然后我们可以将其设计为Azure门户。我们还可以切换视图或代码界面。我们可以使用Visual Studio 2017 的 Azure 逻辑应用工具轻松做到这一点。有关更多详细信息,请参阅在 Visual Studio 中构建和部署逻辑应用

我使用服务总线连接对其进行测试,发布到 Azure 后它可以正常工作

在此输入图像描述