I have created Azure Logic App using Dot.Net SDK. Logic App created successfully but for Trigger and Action i want to use existing Connector. I have manually created connector to Azur Portal. I am passing that Connector's APIConnection or Id to request json but it will not connect to that connector. I mean Logic App is created without any connectors.
Below is my Request 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": "[email protected]",
"Subject": "LogicAppDemo - New Item Created",
"To": "[email protected]"
},
"host": {
"connection": {
"name": "@parameters('$connections')['smtp']['connectionId']"
}
},
"method": "post",
"path": "/SendEmailV2"
},
"runAfter": {},
"type": "ApiConnection"
}
}
}
Here is the screen shot from Azur portal. Here you can see that Logic App is created successfully but without Connector.
Azure Portal Screen Shot
Please Suggest,
Thanks
Hi @HITESHKUMARVAGHASIYA, if you don't have Visual Studio (which is the simplest and easiest option), then you can rely on other alternatives
For the SQL API Connection, you can use this template. Below I show the extract for the SQL API Connection,
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"location": "[parameters('location')]",
"name": "[parameters('sqlConnectionName')]",
"properties": {
"api": {
"id": "[concat(subscription().id,'/providers/Microsoft.Web/locations/', parameters('location'), '/managedApis/sql')]"
},
"displayName": "sql_connection",
"parameterValues": {
"server": "[parameters('sqlServer')]",
"database": "[parameters('sqlDatabase')]",
"authType": "windows",
"username": "[parameters('sqlUser')]",
"password": "[parameters('sqlPassword')]"
}
}
},
To create the SMTP API Connection, I haven't seen a sample, but you could get the ARM definition with Azure CLI (e.g. https://shell.azure.com) and then get the definition of your resource, e.g.
az resource show --ids /subscriptions/680cf604-e2e7-4a14-9724-a26c35c573ff/resourceGroups/logicapp_flow_rnd/providers/Microsoft.Web/connections/smtp
That would give you a starting point to craft your own ARM Template.
Another option is to use PowerShell Template Generator from Jeff Hollan, which I believe exports the API Connections as well.
https://github.com/jeffhollan/LogicAppTemplateCreator
HTH
We also could design our logic app with Azure Logic Apps Tools for Visual Studio 2017 locally. Sign in with our Azure Account, then we could design it as Azure portal. We also could swith view or code interface. We could do that easily with Azure Logic Apps Tools for Visual Studio 2017. For more detail information please refer to Build and Deploy Logic Apps in Visual Studio.
I test it using a servicebus connection, it works correctly after publish to Azure
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With