【发布时间】:2019-09-06 19:12:09
【问题描述】:
我使用本教程创建了一个逻辑应用,只要资源发生更改,它就会通过我的 gmail 帐户向我的工作帐户发送电子邮件:
但是,由于某种原因,每当我更改虚拟机上的任何内容(例如停止/启动它)时,什么都没有发生。当我尝试手动运行触发器时,它会失败并显示以下消息:
未能启动逻辑应用 newLogicApp 的运行。处理您的请求时出错。请稍后再试。
我的所有资源都在同一个订阅下的同一个资源组中。
资源组中没有任何应用服务计划。我不知道这是否需要,如果需要,您如何将该应用服务计划链接到逻辑应用本身。
这是逻辑应用的代码视图:
{
"$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"
}
}
}
}
【问题讨论】: