Create API Connection via REST/ARM Template

Derek Li
2 min readOct 2, 2019

--

Creating API connections in Logic Apps designer is easy. But what if you want to create connections via REST API or ARM deployment template?

The API to create connection looks like this:

PUT https://management.azure.com/subscriptions/{subscription}/resourceGroups/{resourceGroup}/providers/Microsoft.Web/connections/{connector}?api-version=2018-07-01-preview

And in ARM template the resource definition looks like this:

{
“type”: “Microsoft.Web/connections”,
“apiVersion”: “2016–06–01”,
“location”: “[parameters(‘location’)]”,
“name”: “[parameters(‘connectionName’)]”,
“properties”: {}
}

But what goes into the request body for the REST call, and what goes into properties in the ARM template?

To figure out we will call another API: PUT https://management.azure.com/subscriptions/{subscription}/providers/Microsoft.Web/locations/{location}/managedApis/{connector}?api-version=2018–07–01-preview

Look for connectionParameters in the response, it will tell you everything you need to know in order to create a connection for the given connector, SQL in this case:

But wait, there’s easier way. Simply look at the network trace when creating connection in Logic Apps designer, and look for the PUT call to the first API mentioned in this article, and the request body has everything you need.

Of course, you can always use Azure Logic Apps Tools for Visual Studio and it will generate the correct ARM template for connections for your Logic Apps project.

--

--