Skip to content

Instantly share code, notes, and snippets.

@derek1ee
Last active April 28, 2018 02:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derek1ee/6e864246431ff8a3ada068c31cb5f8a4 to your computer and use it in GitHub Desktop.
Save derek1ee/6e864246431ff8a3ada068c31cb5f8a4 to your computer and use it in GitHub Desktop.
{
"$connections": {
"value": {
"azureblob_1": {
"connectionId": "",
"id": "/subscriptions/{0}/providers/Microsoft.Web/locations/{1}/managedApis/azureblob"
},
"azureeventgrid": {
"connectionId": "",
"id": "/subscriptions/{0}/providers/Microsoft.Web/locations/{1}/managedApis/azureeventgrid"
}
}
},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Condition": {
"actions": {
"Compose": {
"inputs": "@{split(triggerBody()?['subject'], '/')?[4]}/@{split(triggerBody()?['subject'], '/')?[6]}",
"runAfter": {
"Delay": [
"Succeeded"
]
},
"type": "Compose"
},
"Delay": {
"inputs": {
"interval": {
"count": 30,
"unit": "Day"
}
},
"runAfter": {},
"type": "Wait"
},
"Delete_blob": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob_1']['connectionId']"
}
},
"method": "delete",
"path": "/datasets/default/files/@{encodeURIComponent(encodeURIComponent(outputs('Compose')))}"
},
"runAfter": {
"Compose": [
"Succeeded"
]
},
"type": "ApiConnection"
}
},
"expression": {
"and": [
{
"equals": [
"@triggerBody()?['eventType']",
"Microsoft.Storage.BlobCreated"
]
}
]
},
"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": null
}
},
"host": {
"connection": {
"name": "@parameters('$connections')['azureeventgrid']['connectionId']"
}
},
"path": "/subscriptions//providers/@{encodeURIComponent('Microsoft.Storage.StorageAccounts')}/resource/eventSubscriptions",
"queries": {
"x-ms-api-version": "2017-09-15-preview"
}
},
"splitOn": "@triggerBody()",
"type": "ApiConnectionWebhook"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment