Azure DevOps: ARM template for SendGrid API Connection for Logic Apps

I had to automate some Logic Apps deployments containing a SendGrid API connection. Since I couldn’t find a ready to use ARM template for the SendGrid API connection, I did reverse engineering to generate the JSON.

Here is the ARM template for the SendGrid Connector:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "sendgridConnectionName": {
      "type": "string"
    },
    "sendgridApiKey": {
      "type": "string"
    }
  },
  "variables": {
    "location": "[resourceGroup().location]",
    "subscriptionId": "[subscription().subscriptionId]",
    "sendgridApiId": "[concat('/subscriptions/', variables('subscriptionId'), '/providers/Microsoft.Web/locations/', variables('location'),'/managedApis/sendgrid')]"
  },
  "resources": [
    {
      "type": "Microsoft.Web/connections",
      "apiVersion": "2016-06-01",
      "name": "[parameters('sendgridConnectionName')]",
      "location": "[variables('location')]",
      "properties": {
        "displayName": "[parameters('sendgridConnectionName')]",
        "customParameterValues": {},
        "api": {
          "id": "[variables('sendgridApiId')]"
        },
        "parameterValues": {
          "apiKey": "[parameters('sendgridApiKey')]"
        }
      }
    }
  ],
  "outputs": {}
}

API Connections are used to connect Logic Apps or Azure Functions to SaaS services. It contains information provided when configuring access to a SaaS service. SendGrid Connection Provider lets you send email and manage recipient lists.