azure-quickstart-templates
azure-quickstart-templates copied to clipboard
201-alert-to-slack-with-logic-app
The 201-alert-to-slack-with-logic-app template appears to be not working ( issue #2514 seems to be the original report of this issue but is closed for some reason )
The problem
After deploying the template and configuring an alert to use the web hook, it fails with:
InvalidTemplate. Unable to process template language expressions in action 'Post_Message' inputs at line '1' and column '1412': 'The template language expression 'triggerBody()['context']['name']' cannot be evaluated because property 'context' doesn't exist, available properties are 'schemaId, data'. Please see https://aka.ms/logicexpressions for usage details.'.
As noted in #2514 I was eventually able to make it work by updating the schema to match what the azure alert is actually sending (it seems like "status", "context", and "properties" are actually inside a "data" node, rather than top level as documented in Configure a webhook on an Azure metric alert)
Hi @bjornicus
I'm having the same issue. Did you manage to resolve it ?
I've found on the net that triggerBody() should be cast as json, but that didn't help
"longUrl": "@{json(triggerBody())['context']['portalLink']}"
Now I'm getting an error
InvalidTemplate. Unable to process template language expressions in action 'Http' inputs at line '1' and column '2711': 'The template language function 'json' expects its parameter to be a string or an XML. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#json for usage details.'.
yes, I did get it working. See my comment in #2514 which contains the schema I used.
@bjornicus I'm also having the same issue, but I'm afraid your fix didn't work :(
When I posted your input into the use sample payload to generate schema
it generated:
{
"schema": {
"properties": {
"data": {
"properties": {
"context": {
"properties": {
"activityLog": {
"properties": {
"authorization": {
"properties": {
"action": {
"type": "string"
},
"scope": {
"type": "string"
}
},
"type": "object"
},
"caller": {
"type": "string"
},
"channels": {
"type": "string"
},
"claims": {
"type": "string"
},
"correlationId": {
"type": "string"
},
"description": {
"type": "string"
},
"eventDataId": {
"type": "string"
},
"eventSource": {
"type": "string"
},
"eventTimestamp": {
"type": "string"
},
"level": {
"type": "string"
},
"operationId": {
"type": "string"
},
"operationName": {
"type": "string"
},
"resourceGroupName": {
"type": "string"
},
"resourceId": {
"type": "string"
},
"resourceProviderName": {
"type": "string"
},
"resourceType": {
"type": "string"
},
"status": {
"type": "string"
},
"subStatus": {
"type": "string"
},
"submissionTimestamp": {
"type": "string"
},
"subscriptionId": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
},
"properties": {
"properties": {},
"type": "object"
},
"status": {
"type": "string"
}
},
"type": "object"
},
"schemaId": {
"type": "string"
}
},
"type": "object"
}
}
The Output connection of the first When a HTTP request is received
says Connection: close
?
And I still get the error at the Http
step in the Logic App:
InvalidTemplate. Unable to process template language expressions in action 'Http' inputs at line '1' and column '1761': 'The template language expression 'triggerBody()['context']['portalLink']' cannot be evaluated because property 'context' cannot be selected. Please see https://aka.ms/logicexpressions for usage details.'.
Am I missing something or is there another way of fixing it?
@architechcro did you fix it using bjornicus' method?
@SurferL sorry to hear it didn't work for you, it's possible things have changed since I posted my fix, although I'm still getting alerts delivered to slack so there's a good chance it should still work. You might try diffing your generated schema with the one I posted in the other issue and see if anything jumps out at you.
@SurferL , try to change triggerBody() to triggerOutputs()?['body']
After spending a while untangling this information, here's a quick recap:
There are two implementations of webhooks. Azure classic alerts webhooks (https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/insights-webhooks-alerts) and the new log alerts webhooks (https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitor-alerts-unified-log-webhook).
This samples works only for the classic alerts. So whenever you want to use the new alert webhooks, you'll have a problem. Look at the provided link for an example JSON, that you can copy and paste in the use sample payload to generate schema
option like @SurferL suggested.
So to the the maintainers: if you just let us know that this is for classic alerts, you'll save a lot of people time :)
So the things to change, in addition to the schema, are (looking at the code view for simplicity, note that the exact ):
-
@{triggerBody()['context']['portalLink']}
becomes@{triggerBody()['data']['LinkToSearchResults']}
-
Azure Alert - '@{triggerBody()['context']['name']}' @{triggerBody()['status']} on '@{triggerBody()['context']['resourceName']}'. Details: @{body('Http')['id']}
becomes something likeAzure Alert - '@{triggerBody()['data']['AlertRuleName']}. Details: @{body('Http')['id']}
(you can fiddle around with the available field, I did not see a "status" field in the new format)
@christianrondeau @SurferL @bjornicus Can one of you post the full ARM template that you've been able to get this working with? I've tried making the modifications that @christianrondeau has mentioned and have not been able to get it working as of yet
@jdogg89 make sure you know whether the webhook you're using is a classic webhook or a log alert webhook. Then, click on When a HTTP request is received
and you'll see Use a sample payload to generate schema
. This is where I generated my schema. Here's the said schema for me:
{
"properties": {
"data": {
"properties": {
"AlertRuleName": {
"type": "string"
},
"AlertThresholdOperator": {
"type": "string"
},
"AlertThresholdValue": {
"type": "integer"
},
"ApplicationId": {
"type": "string"
},
"Description": {
"type": "string"
},
"LinkToSearchResults": {
"type": "string"
},
"ResultCount": {
"type": "integer"
},
"SearchIntervalEndtimeUtc": {
"type": "string"
},
"SearchIntervalInSeconds": {
"type": "integer"
},
"SearchIntervalStartTimeUtc": {
"type": "string"
},
"SearchQuery": {
"type": "string"
},
"SearchResult": {
"properties": {
"tables": {
"items": {
"properties": {
"columns": {
"items": {
"properties": {
"name": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"name",
"type"
],
"type": "object"
},
"type": "array"
},
"name": {
"type": "string"
},
"rows": {
"items": {
"type": "array"
},
"type": "array"
}
},
"required": [
"name",
"columns",
"rows"
],
"type": "object"
},
"type": "array"
}
},
"type": "object"
},
"Severity": {
"type": "string"
},
"SubscriptionId": {
"type": "string"
}
},
"type": "object"
},
"schemaId": {
"type": "string"
}
},
"type": "object"
}
As to why you couldn't make it work, if my suggestions don't help I'd suggest to go step by step. Program the webhook to something like https://webhook.site (never used them, it's just an example), then ensure the payload gets through in Logic App Designer. Check in the Overview tab of your Logic App for failed calls and you should find more details there. If you have a more precise question then, I'll try to help!
I'm doing a log alert webhook, specifically on when someone views storage account keys. Getting the following error:
InvalidTemplate. Unable to process template language expressions in action 'Http' inputs at line '1' and column '1832': 'The template language expression 'triggerBody()['data']['LinkToSearchResults']' cannot be evaluated because property 'data' cannot be selected. Please see https://aka.ms/logicexpressions for usage details.'.
I'll try your schema you just posted in the morning and see where I get, and thanks for the help.
@christianrondeau in you schema section, are you leaving in the variable $schema, as shown here:
"triggers": {
"manual": {
"type": "request",
"kind": "Http",
"inputs": {
"schema": {
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
@christianrondeau can you please share your full azuredeploy.json file so I can diff it to mine? (less any subscription ID's or other personal identifiable info) Here is the file, still getting the error above:
{
"$connections": {
"value": {
"slack": {
"connectionId": "/subscriptions/ID/resourceGroups/RGName/providers/Microsoft.Web/connections/slackConnection",
"connectionName": "slackConnection",
"id": "/subscriptions/ID/providers/Microsoft.Web/locations/eastus/managedApis/slack"
}
}
},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Http": {
"inputs": {
"body": {
"longUrl": "@{triggerBody()['data']['LinkToSearchResults']}"
},
"headers": {
"Content-Type": "application/json"
},
"method": "POST",
"uri": "https://www.googleapis.com/urlshortener/v1/url?key=AIzaSyBkT1BRbA-uULHz8HMUAi0ywJtpNLXHShI"
},
"runAfter": {},
"type": "Http"
},
"Post_Message": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['slack']['connectionId']"
}
},
"method": "post",
"path": "/chat.postMessage",
"queries": {
"channel": "#general",
"text": "Azure Alert - '@{triggerBody()['data']['AlertRuleName']}'. Details: @{body('Http')['id']}"
}
},
"runAfter": {
"Http": [
"Succeeded"
]
},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"schema": {
"properties": {
"data": {
"properties": {
"AlertRuleName": {
"type": "string"
},
"AlertThresholdOperator": {
"type": "string"
},
"AlertThresholdValue": {
"type": "integer"
},
"ApplicationId": {
"type": "string"
},
"Description": {
"type": "string"
},
"LinkToSearchResults": {
"type": "string"
},
"ResultCount": {
"type": "integer"
},
"SearchIntervalEndtimeUtc": {
"type": "string"
},
"SearchIntervalInSeconds": {
"type": "integer"
},
"SearchIntervalStartTimeUtc": {
"type": "string"
},
"SearchQuery": {
"type": "string"
},
"SearchResult": {
"properties": {
"tables": {
"items": {
"properties": {
"columns": {
"items": {
"properties": {
"name": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"name",
"type"
],
"type": "object"
},
"type": "array"
},
"name": {
"type": "string"
},
"rows": {
"items": {
"type": "array"
},
"type": "array"
}
},
"required": [
"name",
"columns",
"rows"
],
"type": "object"
},
"type": "array"
}
},
"type": "object"
},
"Severity": {
"type": "string"
},
"SubscriptionId": {
"type": "string"
}
},
"type": "object"
},
"schemaId": {
"type": "string"
}
},
"type": "object"
}
},
"kind": "Http",
"type": "Request"
}
}
}
}
Was able to make this work finally. my key was adding "activity log" to my schema. @{triggerBody()['data']?['context']['activityLog']['resourceProviderName']}. If anyone else has difficulty I can try assist.
Hey @jdogg89, glad you could figure it out (sorry I wasn't available to help before). Weird you had to manually customize the schema!
@justinhauer hello. Could you please help me on this? With so many different schemas and attempts I wasted a lot of time already to try to make this work, and documentation doesn't help :(
Was able to make this work finally. my key was adding "activity log" to my schema. @{triggerBody()['data']?['context']['activityLog']['resourceProviderName']}. If anyone else has difficulty I can try assist.
Hi @justinhauer are you able share your full azuredeploy.json if possible please?
I'm confused as to what needs to happen in order to make this work as this thread has posted multiple solutions. Do I need to update the azuredeploy.json as @justinhauer suggested?
I removed HTTP POST method (second step) and changed third step to:
"text": "Azure Alert - '@{triggerBody()['body']['body']['data']['context']['name']}' @{triggerBody()?['body']?['body']?['data']?['status']} on '@{triggerBody()['body']['body']['data']['context']['resourceName']}'. Details: @{triggerBody()?['body']?['body']?['data']?['context']?['portalLink']}"
and it works perfectly now:
I would like to express my feelings and alert others from wasting half a day like me.
DO NOT FOLLOW THE INSTRUCTIONS of the Azure Slack Alert
described here: https://learn.microsoft.com/en-us/samples/azure/azure-quickstart-templates/alert-to-slack-with-logic-app/
The Azure Logic app template should be rehauled completely or removed.
- The Alerts do not require specifically a web hook to work, a logic app also is an option in the action group to add also a logic app.
- The second step is pointing to a three year old endpoint of google (google url shortener) which is not only deprecated, but deleted as well.
- This Azure logic app does not distinguish between the old method of alerting and the new method.
Those who are still figuring out you can use this reference which i have worked upon few months ago.
logic_app_worflow.json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"type": "string",
"metadata": {
"description": "The name for the logic app."
}
},
"slackConnectionName": {
"type": "string",
"defaultValue": "SlackConnection",
"metadata": {
"description": "The name for the Slack connection."
}
},
"slackChannel": {
"type": "string",
"defaultValue": "#general",
"metadata": {
"description": "The Slack channel to post to."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
},
"resourceTags": {
"type": "object",
"defaultValue": {
"Environment": "Dev",
"Project": "Tutorial"
}
}
},
"variables": {
"resourceId": "[resourceId('Microsoft.Logic/workflows/triggers', parameters('logicAppName'), 'manual')]",
"apiVersion": "[providers('Microsoft.Logic', 'workflows').apiVersions[0]]"
},
"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2018-07-01-preview",
"location": "[parameters('location')]",
"name": "[parameters('slackConnectionName')]",
"properties": {
"api": {
"id": "[subscriptionResourceId('Microsoft.Web/locations/managedApis', parameters('location'), 'slack')]"
},
"displayName": "slack"
}
},
{
"type": "Microsoft.Logic/workflows",
"apiVersion": "2019-05-01",
"name": "[parameters('logicAppName')]",
"dependsOn": [
"[resourceId('Microsoft.Web/connections', parameters('slackConnectionName'))]"
],
"location": "[parameters('location')]",
"tags": "[parameters('resourceTags')]",
"properties": {
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"type": "Request",
"kind": "Http",
"inputs": {
"schema": {
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"context": {
"properties": {
"name": {
"type": "string"
},
"portalLink": {
"type": "string"
},
"resourceName": {
"type": "string"
}
},
"required": [
"name",
"portalLink",
"resourceName"
],
"type": "object"
},
"status": {
"type": "string"
}
},
"required": [
"status",
"context"
],
"type": "object"
}
}
}
},
"actions": {
"Condition": {
"actions": {
"Post_message_(V2)": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"body": {
"channel": "[parameters('slackChannel')]",
"text": "Alert with name *\"@{triggerBody()['data']['context']['name']}\"* was Triggered for *\"@{triggerBody()['data']['context']['resourceName']}\"* with Severity - @{triggerBody()['data']['context']['severity']}.(@{triggerBody()['data']['context']['portalLink']})",
"username": "Azure Alerts"
},
"host": {
"connection": {
"name": "@parameters('$connections')['slack']['connectionId']"
}
},
"method": "post",
"path": "/v2/chat.postMessage"
}
}
},
"runAfter": {},
"else": {
"actions": {
"Post_message_(V2)_2": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"body": {
"channel": "[parameters('slackChannel')]",
"text": "Alert with name *\"@{triggerBody()['data']['context']['name']}\"* was Resolved for *\"@{triggerBody()['data']['context']['resourceName']}\"* with Severity - @{triggerBody()['data']['context']['severity']}.(@{triggerBody()['data']['context']['portalLink']})",
"username": "Azure Alerts"
},
"host": {
"connection": {
"name": "@parameters('$connections')['slack']['connectionId']"
}
},
"method": "post",
"path": "/v2/chat.postMessage"
}
}
}
},
"expression": {
"and": [
{
"equals": [
"@{triggerBody()?['data']?['status']}",
"Activated"
]
}
]
},
"type": "If"
}
},
"outputs": {}
},
"parameters": {
"$connections": {
"value": {
"slack": {
"id": "[subscriptionResourceId('Microsoft.Web/locations/managedApis', parameters('location'), 'slack')]",
"connectionId": "[resourceId('Microsoft.Web/connections', parameters('slackConnectionName'))]"
}
}
}
}
}
}
],
"outputs": {
"endpointUrl": {
"type": "string",
"value": "[listCallbackUrl(variables('resourceId'), variables('apiVersion')).value]"
}
}
}
I have written detailed blog for Teams connection, it also works similar to this.
Blog - Send Azure Infrastructure Alerts to Microsoft Teams!
If the issue is resolved feel free to close this issue.
@ajinkya101 I used your template and created a second logic app but unfortunately it didn't work.
InvalidTemplate.
Unable to process template language expressions in action 'Post_message_(V2)_2' inputs at line
'0' and column '0': 'The template language expression 'triggerBody()['data']['context']['name']'
cannot be evaluated because property 'context' doesn't exist, available properties are 'essentials,
alertContext, customProperties'. Please see https://aka.ms/logicexpressions for usage details.'.
The incoming json was
{
"headers": {
"Connection": "Keep-Alive",
"Expect": "100-continue",
"Host": "XXX.logic.azure.com",
"User-Agent": "IcMBroadcaster/1.0",
"X-CorrelationContext": "RkkKACgAAAACAAAAEAAnF7RiX6GCQrpeNhQY0QxIAQAQAK1qpfc2RQ1IqFVTbYCfFWE=",
"Content-Length": "1266",
"Content-Type": "application/json; charset=utf-8"
},
"body": {
"schemaId": "azureMonitorCommonAlertSchema",
"data": {
"essentials": {
"alertId": "/subscriptions/<sub-id>/providers/Microsoft.AlertsManagement/alerts/7eac1b3f-5fcc-4090-8605-51ffaf58f319",
"alertRule": "HIGH SQL DTU Consumption",
"severity": "Sev0",
"signalType": "Metric",
"monitorCondition": "Fired",
"monitoringService": "Platform",
"alertTargetIDs": [
"/subscriptions/<sub-id>/resourcegroups/production/providers/microsoft.sql/servers/<db>/databases/<companyname>"
],
"configurationItems": [
"<companyname>"
],
"originAlertId": "<sub-id>_Production_microsoft.insights_metricAlerts_HIGH SQL DTU Consumption_-225577070",
"firedDateTime": "2022-11-29T11:35:05.6070295Z",
"description": "",
"essentialsVersion": "1.0",
"alertContextVersion": "1.0"
},
"alertContext": {
"properties": null,
"conditionType": "MultipleResourceMultipleMetricCriteria",
"condition": {
"windowSize": "PT15M",
"allOf": [
{
"metricName": "dtu_used",
"metricNamespace": "MICROSOFT.SQL/SERVERS/DATABASES",
"operator": "GreaterThan",
"threshold": "10",
"timeAggregation": "Average",
"dimensions": [],
"metricValue": 14.4266666666667,
"webTestName": null
}
],
"windowStartTime": "2022-11-29T11:16:59.373Z",
"windowEndTime": "2022-11-29T11:31:59.373Z"
}
},
"customProperties": null
}
}
}
@SpyPower , Here is the incoming json generated by my Sample Redis alert webhook.
{
"headers": {
"Connection": "Keep-Alive",
"Expect": "100-continue",
"Host": "prod-06.westeurope.logic.azure.com",
"User-Agent": "IcMBroadcaster/1.0",
"X-CorrelationContext": "RkkKACgAAAACAAAAEAB4fYq+T1t9TrAcGtp+g4viAQAQAJYf0oRjz8FJs5i7Jx7cm8E=",
"Content-Length": "1256",
"Content-Type": "application/json; charset=utf-8"
},
"body": {
"schemaId": "AzureMonitorMetricAlert",
"data": {
"version": "2.0",
"properties": null,
"status": "Activated",
"context": {
"timestamp": "2022-11-29T16:46:27.3937047Z",
"id": "/subscriptions/<sub-id>/resourceGroups/azcost/providers/Microsoft.Insights/metricAlerts/qaredis01-cpu-metricalert",
"name": "qaredis01-cpu-metricalert",
"description": "This alert will be triggered when CPU Percentage reach above 90 Percentage for Azure Redis Cache Instance",
"conditionType": "MultipleResourceMultipleMetricCriteria",
"severity": "2",
"condition": {
"windowSize": "PT5M",
"allOf": [
{
"metricName": "percentProcessorTime",
"metricNamespace": "Microsoft.Cache/Redis",
"operator": "GreaterThan",
"threshold": "2",
"timeAggregation": "Average",
"dimensions": [],
"metricValue": 2.45,
"webTestName": null
}
]
},
"subscriptionId": "<sub-id>",
"resourceGroupName": "azcost",
"resourceName": "redis-feat-authert",
"resourceType": "Microsoft.Cache/Redis",
"resourceId": "/subscriptions/<sub-id>/resourceGroups/azcost/providers/Microsoft.Cache/Redis/redis-feat-authert",
"portalLink": "https://portal.azure.com/#resource/subscriptions/<sub-id>/resourceGroups/azcost/providers/Microsoft.Cache/Redis/redis-feat-authert"
}
}
}
}
Use the alert webhook result of your resource and according to it, you have to modify the message written in workflow.
Was able to make this work finally. my key was adding "activity log" to my schema. @{triggerBody()['data']?['context']['activityLog']['resourceProviderName']}. If anyone else has difficulty I can try assist.
Thanks so much mate, you helped me with this when I needed you d most, I would like to buy you a coffee 💯
The template is still published in public, and still broken for the majority of people trying to use it, so either the template needs updating or take down the web page? (The page lists contributors as @bmoore-msft, @javid-spektra, @akhilthomas011, in case any of you are still around)
Like others, I had the ...'context' doesn't exist...
errors from the start of this Issue, when using the template published on the Microsoft site and referred to here, and also when using the workflow from @ajinkya101. Like @SpyPower I had JSON like this which iun my case comes from a Metric Alert Rule with an Action Group that points to the Logic App as an action. And yes, context
really was not there in the JSON from the inbound payload into the Logic App. Therefore all the lines with ['context']
fail, such as lines like this:
"text": "Alert with name *\"@{triggerBody()['data']['context']['name']}\"* was Triggered for *\"@{triggerBody()['data']['context']['resourceName']}\"* with Severity - @{triggerBody()['data']['context']['severity']}.(@{triggerBody()['data']['context']['portalLink']})",
.
Side note: It took me ages to find the incoming JSON payload so I could see for myself why the original template wasn't working. When you are in Run History, then Run Details for a run, the "Outputs Link" gives you the inbound JSON; totally logical for the inbound JSON payload to be found under the outputs link .
In case anyone is interested or finds this useful in future, here is the code from the logic app I used in the end, with amended references replacing context
paths with essentials
paths, and also amended conditional statement (expression
) pointing to the monitorCondition
:
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Condition": {
"actions": {
"Post_message_(V2)": {
"inputs": {
"body": {
"channel": "#myapp-ops",
"text": ":myapp: MyApp alerting rule *\"@{triggerBody()['data']['essentials']['alertRule']}\"* was Triggered with severity @{triggerBody()['data']['essentials']['severity']} (@{triggerBody()['data']['essentials']['description']})",
"username": "Azure Alerts"
},
"host": {
"connection": {
"name": "@parameters('$connections')['slack']['connectionId']"
}
},
"method": "post",
"path": "/v2/chat.postMessage"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"else": {
"actions": {
"Post_message_(V2)_2": {
"inputs": {
"body": {
"channel": "#myapp-ops",
"text": ":myapp: MyApp alerting rule *\"@{triggerBody()['data']['essentials']['alertRule']}\"* was Resolved",
"username": "Azure Alerts"
},
"host": {
"connection": {
"name": "@parameters('$connections')['slack']['connectionId']"
}
},
"method": "post",
"path": "/v2/chat.postMessage"
},
"runAfter": {},
"type": "ApiConnection"
}
}
},
"expression": {
"and": [
{
"equals": [
"@{triggerBody()?['data']?['essentials']?['monitorCondition']}",
"Fired"
]
}
]
},
"runAfter": {},
"type": "If"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"schema": {
"properties": {
"body": {
"properties": {
"data": {
"properties": {
"alertContext": {
"properties": {
"condition": {
"properties": {
"allOf": {
"items": {
"properties": {
"dimensions": {
"items": {
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"name",
"value"
],
"type": "object"
},
"type": "array"
},
"metricName": {
"type": "string"
},
"metricNamespace": {
"type": "string"
},
"metricValue": {
"type": "integer"
},
"operator": {
"type": "string"
},
"threshold": {
"type": "string"
},
"timeAggregation": {
"type": "string"
},
"webTestName": {}
},
"required": [
"metricName",
"metricNamespace",
"operator",
"threshold",
"timeAggregation",
"dimensions",
"metricValue",
"webTestName"
],
"type": "object"
},
"type": "array"
},
"windowEndTime": {
"type": "string"
},
"windowSize": {
"type": "string"
},
"windowStartTime": {
"type": "string"
}
},
"type": "object"
},
"conditionType": {
"type": "string"
},
"properties": {
"properties": {
"customKey1": {
"type": "string"
},
"customKey2": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
},
"customProperties": {
"properties": {
"customKey1": {
"type": "string"
},
"customKey2": {
"type": "string"
}
},
"type": "object"
},
"essentials": {
"properties": {
"alertContextVersion": {
"type": "string"
},
"alertId": {
"type": "string"
},
"alertRule": {
"type": "string"
},
"alertTargetIDs": {
"items": {
"type": "string"
},
"type": "array"
},
"configurationItems": {
"items": {
"type": "string"
},
"type": "array"
},
"description": {
"type": "string"
},
"essentialsVersion": {
"type": "string"
},
"firedDateTime": {
"type": "string"
},
"monitorCondition": {
"type": "string"
},
"monitoringService": {
"type": "string"
},
"originAlertId": {
"type": "string"
},
"severity": {
"type": "string"
},
"signalType": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
},
"schemaId": {
"type": "string"
}
},
"type": "object"
},
"headers": {
"properties": {
"CLIENT-IP": {
"type": "string"
},
"Content-Length": {
"type": "string"
},
"Content-Type": {
"type": "string"
},
"DISGUISED-HOST": {
"type": "string"
},
"Expect": {
"type": "string"
},
"Host": {
"type": "string"
},
"Max-Forwards": {
"type": "string"
},
"User-Agent": {
"type": "string"
},
"WAS-DEFAULT-HOSTNAME": {
"type": "string"
},
"X-ARR-LOG-ID": {
"type": "string"
},
"X-ARR-SSL": {
"type": "string"
},
"X-AppService-Proto": {
"type": "string"
},
"X-CorrelationContext": {
"type": "string"
},
"X-Forwarded-For": {
"type": "string"
},
"X-Forwarded-Proto": {
"type": "string"
},
"X-Forwarded-TlsVersion": {
"type": "string"
},
"X-Original-URL": {
"type": "string"
},
"X-SITE-DEPLOYMENT-ID": {
"type": "string"
},
"X-WAWS-Unencoded-URL": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {
"$connections": {
"value": {
"slack": {
"connectionId": "/subscriptions/redacted-subscription-id/resourceGroups/MyApp_RG/providers/Microsoft.Web/connections/Slack_Connection",
"connectionName": "Slack_Connection",
"id": "/subscriptions/redacted-subscription-id/providers/Microsoft.Web/locations/eastus/managedApis/slack"
}
}
}
}
}