From 94fb1214b558afadec62b5c5cfd7252ad7f6424d Mon Sep 17 00:00:00 2001 From: shahparth-lab <80121421+shahparth-lab@users.noreply.github.com> Date: Wed, 26 May 2021 17:05:11 -0700 Subject: [PATCH 1/5] Create notify-when-blob-added-updated.json This is a brand new template for being notified when a blob is added or updated in a storage account container --- templates/notify-when-blob-added-updated.json | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 templates/notify-when-blob-added-updated.json diff --git a/templates/notify-when-blob-added-updated.json b/templates/notify-when-blob-added-updated.json new file mode 100644 index 0000000..d459223 --- /dev/null +++ b/templates/notify-when-blob-added-updated.json @@ -0,0 +1,103 @@ +{ + "id": "Notify_when_a_blob_is_added_or_updated", + "title": "Notify when a blob is added or updated", + "description": "Sends an email when a blob is added or updated to container", + "iconType": "Event", + "data": { + "definition": { + "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", + "actions": { + "Send_an_email_(V2)": { + "inputs": { + "body": { + "Body": "

Here are the list of files that were added or updated:
\n@{triggerBody()?['Path']}

", + "Subject": "New content added @{triggerBody()?['DisplayName']}", + "To": "@parameters('emailTo')" + }, + "host": { + "connection": { + "name": "@parameters('$connections')['office365']['connectionId']" + } + }, + "method": "post", + "path": "/v2/Mail" + }, + "runAfter": {}, + "type": "ApiConnection" + } + }, + "contentVersion": "1.0.0.0", + "outputs": {}, + "parameters": { + "$connections": { + "defaultValue": {}, + "type": "Object" + }, + "BlobContainer": { + "type": "String", + "defaultValue": "/container", + "metadata": { + "displayName": "Container name", + "required": true, + "description": "Container in whcih blobs are residing" + } + }, + "emailTo": { + "type": "String", + "metadata": { + "displayName": "Notify me on", + "defaultValue": "user@contoso.com", + "required": true, + "description": "Enter email id to be notified on" + } + } + }, + "triggers": { + "When_a_blob_is_added_or_modified_(properties_only)": { + "inputs": { + "host": { + "connection": { + "name": "@parameters('$connections')['azureblob_1']['connectionId']" + } + }, + "method": "get", + "path": "/datasets/default/triggers/batch/onupdatedfile", + "queries": { + "checkBothCreatedAndModifiedDateTime": false, + "folderId": "@parameters('BlobContainer')", + "maxFileCount": 10 + } + }, + "metadata": { + "JTJmY29udGFpbmVy": "/container" + }, + "recurrence": { + "frequency": "Minute", + "interval": 3 + }, + "splitOn": "@triggerBody()", + "type": "ApiConnection" + } + } + }, + "parameters": { + "$connections": { + "value": { + "azureblob_1": { + "connectionId": "", + "connectionName": "", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/locations/westus/managedApis/azureblob" + }, + "office365": { + "connectionId": "", + "connectionName": "", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/locations/westus/managedApis/office365" + } + } + } + } + }, + "supportedResources": [ + "Microsoft.Storage/storageAccounts" + ] +} From f09a0814627b6cd969baebaa0e574952043bf98a Mon Sep 17 00:00:00 2001 From: shahparth-lab <80121421+shahparth-lab@users.noreply.github.com> Date: Wed, 26 May 2021 17:09:25 -0700 Subject: [PATCH 2/5] Update manifest.json --- templates/manifest.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/manifest.json b/templates/manifest.json index f0af446..e7cf648 100644 --- a/templates/manifest.json +++ b/templates/manifest.json @@ -5,5 +5,6 @@ "poweroff-vm-new.json", "deallocate-vm-new.json", "cosmos-send-query-result.json", - "delete-old-blob.json" + "delete-old-blob.json", + "notify-when-blob-added-updated.json" ] From 9bba19cd6c52ee320a12099cc3a95dd2992c62cb Mon Sep 17 00:00:00 2001 From: shahparth-lab <80121421+shahparth-lab@users.noreply.github.com> Date: Wed, 26 May 2021 17:19:34 -0700 Subject: [PATCH 3/5] Update notify-when-blob-added-updated.json --- templates/notify-when-blob-added-updated.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/notify-when-blob-added-updated.json b/templates/notify-when-blob-added-updated.json index d459223..be7bc0c 100644 --- a/templates/notify-when-blob-added-updated.json +++ b/templates/notify-when-blob-added-updated.json @@ -1,6 +1,6 @@ { "id": "Notify_when_a_blob_is_added_or_updated", - "title": "Notify when a blob is added or updated", + "title": "Notify when a change is made in container", "description": "Sends an email when a blob is added or updated to container", "iconType": "Event", "data": { From af1a581829fbd7c66dbd5752cbe2c7d4e19e8680 Mon Sep 17 00:00:00 2001 From: shahparth-lab Date: Tue, 22 Jun 2021 11:48:59 -0700 Subject: [PATCH 4/5] Create copy-msg-storage.json --- templates/copy-msg-storage.json | 103 ++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 templates/copy-msg-storage.json diff --git a/templates/copy-msg-storage.json b/templates/copy-msg-storage.json new file mode 100644 index 0000000..9ba0b79 --- /dev/null +++ b/templates/copy-msg-storage.json @@ -0,0 +1,103 @@ +{ + "id": "copy-message-svcbus-storage", + "title": "Copy new messages from Service bus queue to Storage container", + "description": "When a new message arrives in queue, create a blob to store", + "iconType": "Event", + "data": { + "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" + }, + "Container name": { + "type": "String", + "defaultValue": "container", + "metadata": { + "displayName": "Blob Container", + "required": false, + "description": "Stroage container where messages will be copied to" + } + }, + "Queue name": { + "type": "String", + "defaultValue": "queue", + "metadata": { + "displayName": "Queue", + "required": false, + "description": "Name of service bus queue which will receive messages" + } + } + }, + "triggers": { + "When_a_message_is_received_in_a_queue_(auto-complete)": { + "recurrence": { + "frequency": "Minute", + "interval": 3 + }, + "type": "ApiConnection", + "inputs": { + "host": { + "connection": { + "name": "@parameters('$connections')['servicebus']['connectionId']" + } + }, + "method": "get", + "path": "/@{encodeURIComponent(encodeURIComponent('approvalqueue'))}/messages/head", + "queries": { + "queueType": "Main" + } + } + } + }, + "actions": { + "Create_blob": { + "runAfter": {}, + "type": "ApiConnection", + "inputs": { + "body": "@base64ToBinary(triggerBody()?['ContentData'])", + "host": { + "connection": { + "name": "@parameters('$connections')['azureblob']['connectionId']" + } + }, + "method": "post", + "path": "/datasets/default/files", + "queries": { + "folderPath": "container", + "name": "svc-bus-msg-@{guid()}", + "queryParametersSingleEncoded": true + } + }, + "runtimeConfiguration": { + "contentTransfer": { + "transferMode": "Chunked" + } + } + } + }, + "outputs": {} + }, + "parameters": { + "$connections": { + "value": { + "azureblob": { + "connectionId": "", + "connectionName": "", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/locations/westus/managedApis/azureblob" + }, + "servicebus": { + "connectionId": "", + "connectionName": "", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/locations/westus/managedApis/servicebus" + } + } + } + } + }, + "supportedResources": [ + "Microsoft.ServiceBus/namespaces" + ] +} \ No newline at end of file From c3d8a9d738b360a03f725335c72ac52e8e1806a1 Mon Sep 17 00:00:00 2001 From: shahparth-lab <80121421+shahparth-lab@users.noreply.github.com> Date: Tue, 22 Jun 2021 12:07:51 -0700 Subject: [PATCH 5/5] Delete copy-msg-storage.json deleting the copy message file from this "new-template" branch as there is an already existing PR for another template on this branch. Will create a new branch to submit a new PR for the new template of "Copy messages from service bus to storage" --- templates/copy-msg-storage.json | 103 -------------------------------- 1 file changed, 103 deletions(-) delete mode 100644 templates/copy-msg-storage.json diff --git a/templates/copy-msg-storage.json b/templates/copy-msg-storage.json deleted file mode 100644 index 9ba0b79..0000000 --- a/templates/copy-msg-storage.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "id": "copy-message-svcbus-storage", - "title": "Copy new messages from Service bus queue to Storage container", - "description": "When a new message arrives in queue, create a blob to store", - "iconType": "Event", - "data": { - "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" - }, - "Container name": { - "type": "String", - "defaultValue": "container", - "metadata": { - "displayName": "Blob Container", - "required": false, - "description": "Stroage container where messages will be copied to" - } - }, - "Queue name": { - "type": "String", - "defaultValue": "queue", - "metadata": { - "displayName": "Queue", - "required": false, - "description": "Name of service bus queue which will receive messages" - } - } - }, - "triggers": { - "When_a_message_is_received_in_a_queue_(auto-complete)": { - "recurrence": { - "frequency": "Minute", - "interval": 3 - }, - "type": "ApiConnection", - "inputs": { - "host": { - "connection": { - "name": "@parameters('$connections')['servicebus']['connectionId']" - } - }, - "method": "get", - "path": "/@{encodeURIComponent(encodeURIComponent('approvalqueue'))}/messages/head", - "queries": { - "queueType": "Main" - } - } - } - }, - "actions": { - "Create_blob": { - "runAfter": {}, - "type": "ApiConnection", - "inputs": { - "body": "@base64ToBinary(triggerBody()?['ContentData'])", - "host": { - "connection": { - "name": "@parameters('$connections')['azureblob']['connectionId']" - } - }, - "method": "post", - "path": "/datasets/default/files", - "queries": { - "folderPath": "container", - "name": "svc-bus-msg-@{guid()}", - "queryParametersSingleEncoded": true - } - }, - "runtimeConfiguration": { - "contentTransfer": { - "transferMode": "Chunked" - } - } - } - }, - "outputs": {} - }, - "parameters": { - "$connections": { - "value": { - "azureblob": { - "connectionId": "", - "connectionName": "", - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/locations/westus/managedApis/azureblob" - }, - "servicebus": { - "connectionId": "", - "connectionName": "", - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/locations/westus/managedApis/servicebus" - } - } - } - } - }, - "supportedResources": [ - "Microsoft.ServiceBus/namespaces" - ] -} \ No newline at end of file