TIP

💡 Learn more : Azure Logic Apps Documentation.

This post brought to you by afnw35342. His LinkedIn profile is available here.

Explicitly Name Logic API Connections in ARM Templates

When creating Logic App API Connections, Azure defaults to rather bland, non-descriptive names such as office365 or keyvault. After creating a few of them, positively identifying them gets confusing. (Separate connections should be created as each Logic App should have a unique, system-assigned identity.)

1. Edit the Connection Specification

In the example below, the name and displayName segments are changed to calculated values using [variables('vEmailSender')].

{
    "type": "Microsoft.Web/connections",
    "apiVersion": "2016-06-01",
    "name": "[variables('vEmailSender')]",
    "location": "[parameters('pLocation')]",
    "properties": {
        "api": {
            "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('pLocation'), '/managedApis/office365')]"
        },
        "displayName": "[variables('vEmailSender')]"
    }
}
1
2
3
4
5
6
7
8
9
10
11
12

(Parameters are equally valid here.)

It can cause confusion that both the name and displayName segments also default to office365. Do not change the api/id segment!

2. Modify the dependsOn segment of the Logic App

{
    ...
    "dependsOn": [
        "[resourceId('Microsoft.Web/connections', variables('vEmailSender'))]"
    ]
    ...
}
1
2
3
4
5
6
7

3. Modify the $connections used by the Logic App

The connection definition used in the Logic App must match the resource definition in (1).

{
    "$connections": {
        "value": {
            "office365": {
                "connectionId": "[resourceId('Microsoft.Web/connections', variables('vEmailSender'))]",
                "connectionName": "[variables('vEmailSender')]",
                "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/',parameters('pLocation'),'/managedApis/office365')]"
            }
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11

Notice how connectionId is a concatenation of the resource type and name, and the id is the same as the api/id.

Conclusion

It wasn't entirely clear what specifically needed changing in what locations to modify the defaults. Hopefully, this tip will save you the hit-n-miss process I went through.