title: How do you get Azure Logic app to send an email
body: <p>I used this tutorial to create a logic app that sends an email through my gmail account to my work account whenever a resource changes: </p>
  
  <p><a href="https://docs.microsoft.com/en-us/azure/event-grid/monitor-virtual-machine-changes-event-grid-logic-app" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/event-grid/monitor-virtual-machine-changes-event-grid-logic-app</a></p>
  
  <p>However, for some reason, whenever I change anything on virtual machine, for example stopping/starting it, nothing happens. When I try to run the trigger manually, it fails with the message:</p>
  
  <p>Failed to start a run of logic app newLogicApp. There was an error processing your request. Please try again in a few moments.</p>
  
  <p>All of my resources are in the same resource group under the same subscription. </p>
  
  <p>The resource group doesn't have any app service plan in it. I don't know if this is required and if it is, how do you link that app service plan to the logic app itself.</p>
  
  <p>Here's a code view of the logic app:</p>
  
  <pre><code>{
      "$connections": {
          "value": {
              "azureeventgrid": {
                  "connectionId": "/subscriptions/7137186b-8ebc-4bc6-952f-55efcb96d2f5/resourceGroups/testRG/providers/Microsoft.Web/connections/azureeventgrid-2",
                  "connectionName": "azureeventgrid-2",
                  "id": "/subscriptions/7137186b-8ebc-4bc6-952f-55efcb96d2f5/providers/Microsoft.Web/locations/eastus/managedApis/azureeventgrid"
              },
              "gmail_1": {
                  "connectionId": "/subscriptions/7137186b-8ebc-4bc6-952f-55efcb96d2f5/resourceGroups/testRG/providers/Microsoft.Web/connections/gmail-1",
                  "connectionName": "gmail-1",
                  "id": "/subscriptions/7137186b-8ebc-4bc6-952f-55efcb96d2f5/providers/Microsoft.Web/locations/eastus/managedApis/gmail"
              }
          }
      },
      "definition": {
          "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
          "actions": {
              "Condition": {
                  "actions": {
                      "Send_email": {
                          "inputs": {
                              "body": {
                                  "Body": "Resource: @{triggerBody()?['topic']}\n\nEvent Type: @{triggerBody()?['eventType']}\n\nEvent ID: @{triggerBody()?['id']}\n\nTime: @{triggerBody()?['eventTime']}",
                                  "Subject": "Resource updated: @{triggerBody()?['subject']}",
                                  "To": "xxx@yyy.com"
                              },
                              "host": {
                                  "connection": {
                                      "name": "@parameters('$connections')['gmail_1']['connectionId']"
                                  }
                              },
                              "method": "post",
                              "path": "/Mail"
                          },
                          "runAfter": {},
                          "type": "ApiConnection"
                      }
                  },
                  "expression": {
                      "and": [
                          {
                              "equals": [
                                  "@triggerBody()?['data']['operationName']",
                                  "Microsoft.Compute/virtualMachines/write"
                              ]
                          }
                      ]
                  },
                  "runAfter": {},
                  "type": "If"
              }
          },
          "contentVersion": "1.0.0.0",
          "outputs": {},
          "parameters": {
              "$connections": {
                  "defaultValue": {},
                  "type": "Object"
              }
          },
          "triggers": {
              "When_a_resource_event_occurs": {
                  "inputs": {
                      "body": {
                          "properties": {
                              "destination": {
                                  "endpointType": "webhook",
                                  "properties": {
                                      "endpointUrl": "@{listCallbackUrl()}"
                                  }
                              },
                              "topic": "/subscriptions/7137186b-8ebc-4bc6-952f-55efcb96d2f5/resourceGroups/testRG"
                          }
                      },
                      "host": {
                          "connection": {
                              "name": "@parameters('$connections')['azureeventgrid']['connectionId']"
                          }
                      },
                      "path": "/subscriptions/@{encodeURIComponent('7137186b-8ebc-4bc6-952f-55efcb96d2f5')}/providers/@{encodeURIComponent('Microsoft.Resources.ResourceGroups')}/resource/eventSubscriptions",
                      "queries": {
                          "x-ms-api-version": "2017-09-15-preview"
                      }
                  },
                  "splitOn": "@triggerBody()",
                  "type": "ApiConnectionWebhook"
              }
          }
      }
  }
  </code></pre>