Created
April 24, 2018 17:42
-
-
Save derek1ee/3c74ac51b4719102a69dc28326c33a06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$connections": { | |
"value": { | |
"azureblob_1": { | |
"connectionId": "", | |
"id": "/subscriptions/{0}/providers/Microsoft.Web/locations/{1}/managedApis/azureblob" | |
}, | |
"azureeventgrid_1": { | |
"connectionId": "", | |
"id": "/subscriptions/{0}/providers/Microsoft.Web/locations/{1}/managedApis/azureeventgrid" | |
}, | |
"cognitiveservicescomputervision": { | |
"connectionId": "", | |
"id": "/subscriptions/{0}/providers/Microsoft.Web/locations/{1}/managedApis/cognitiveservicescomputervision" | |
}, | |
"sharepointonline": { | |
"connectionId": "", | |
"id": "/subscriptions/{0}/providers/Microsoft.Web/locations/{1}/managedApis/sharepointonline" | |
} | |
} | |
}, | |
"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": {}, | |
"type": "Compose" | |
}, | |
"Create_SAS_URI_by_path": { | |
"inputs": { | |
"body": { | |
"Permissions": "Read" | |
}, | |
"host": { | |
"connection": { | |
"name": "@parameters('$connections')['azureblob_1']['connectionId']" | |
} | |
}, | |
"method": "post", | |
"path": "/datasets/default/CreateSharedLinkByPath", | |
"queries": { | |
"path": "@{outputs('Compose')}" | |
} | |
}, | |
"runAfter": { | |
"Compose": [ | |
"Succeeded" | |
] | |
}, | |
"type": "ApiConnection" | |
}, | |
"Create_file": { | |
"inputs": { | |
"body": "@body('Optical_Character_Recognition_(OCR)_to_Text')?['text']", | |
"host": { | |
"connection": { | |
"name": "@parameters('$connections')['sharepointonline']['connectionId']" | |
} | |
}, | |
"method": "post", | |
"path": "/datasets//files", | |
"queries": { | |
"folderPath": null, | |
"name": @{triggerBody()?['data']?['eTag']}.txt, | |
"queryParametersSingleEncoded": true | |
} | |
}, | |
"runAfter": { | |
"Optical_Character_Recognition_(OCR)_to_Text": [ | |
"Succeeded" | |
] | |
}, | |
"type": "ApiConnection" | |
}, | |
"Optical_Character_Recognition_(OCR)_to_Text": { | |
"inputs": { | |
"body": { | |
"url": "@body('Create_SAS_URI_by_path')?['WebUrl']" | |
}, | |
"host": { | |
"connection": { | |
"name": "@parameters('$connections')['cognitiveservicescomputervision']['connectionId']" | |
} | |
}, | |
"method": "post", | |
"path": "/vision/v1.0/ocrtext", | |
"queries": { | |
"detectOrientation": true, | |
"format": "Image URL", | |
"language": "unk" | |
} | |
}, | |
"runAfter": { | |
"Create_SAS_URI_by_path": [ | |
"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()}" | |
} | |
}, | |
"filter": { | |
"subjectEndsWith": ".jpg" | |
}, | |
"topic": null | |
} | |
}, | |
"host": { | |
"connection": { | |
"name": "@parameters('$connections')['azureeventgrid_1']['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