Azure Logic App - Check multiple conditions - azure

I am trying to check the files count in array and perform below actions
If Count is 0, No action
If Count is 1, perform a specific action
If Count is greater than 1, perform another set of action.
I am using length expression to check the array file count using length(body('Filter_blobs_which_added_in_last_15min'))
Currently I am following below logic ( 2 step condition, first check if the value is zero, and then check if value is 1 or greater than 1). Is there anyway I can combine this into single condition ?

You can achieve this by using Switch condition in your workflow as shown below.
We have created a logic app which will calculate, the number of blobs present in the storage account, using compose & length function (we have calculated the number of blobs) based on the blob count the switch statement associates actions will be executed further.
And also we have tested this in our local environment which is working fine.
Here is the logic app Designer Image:
Here is the code view of the logic app :
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Compose": {
"inputs": "#length(body('Lists_blobs_(V2)')?['value'])",
"runAfter": {
"Lists_blobs_(V2)": [
"Succeeded"
]
},
"type": "Compose"
},
"Lists_blobs_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/foldersV2/#{encodeURIComponent(encodeURIComponent('JTJmY29udDE='))}",
"queries": {
"nextPageMarker": "",
"useFlatListing": false
}
},
"metadata": {
"JTJmY29udDE=": "/cont1"
},
"runAfter": {},
"type": "ApiConnection"
},
"Switch": {
"cases": {
"Case": {
"actions": {
"Compose_4": {
"inputs": "length of blob are #{outputs('Compose')}",
"runAfter": {},
"type": "Compose"
}
},
"case": 0
},
"Case_2": {
"actions": {
"Compose_3": {
"inputs": "length of blobs are #{outputs('Compose')}",
"runAfter": {},
"type": "Compose"
}
},
"case": 1
}
},
"default": {
"actions": {
"Compose_2": {
"inputs": "length of blobs are #{outputs('Compose')}",
"runAfter": {},
"type": "Compose"
}
}
},
"expression": "#outputs('Compose')",
"runAfter": {
"Compose": [
"Succeeded"
]
},
"type": "Switch"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"Recurrence": {
"evaluatedRecurrence": {
"frequency": "Minute",
"interval": 3
},
"recurrence": {
"frequency": "Minute",
"interval": 3
},
"type": "Recurrence"
}
}
},
"parameters": {
"$connections": {
"value": {
"azureblob": {
"connectionId": "/subscriptions/<subId>/resourceGroups/<rgName>/providers/Microsoft.Web/connections/azureblob",
"connectionName": "azureblob",
"id": "/subscriptions/<subId>/providers/Microsoft.Web/locations/eastus/managedApis/azureblob"
}
}
}
}
}
Here is the sample output for reference:

Related

How to get a logic app to stop running after a successful run each day

I have a logic app that I want to run once a line item appears in a table each day. once that line item appear, i don't want the logic app to run anymore that day. Can't quite think of how to accomplish this.
Apart from using the related triggers you can use Terminate action to stop the flow.
After using Get entities (V2) I'm trying to Parse the result to get the timestamp of that particular entity to check if the table has an added row or not for that day
After parsing below is the condition that I'm using
{
"contains": [
"#formatDateTime(body('Parse_JSON')?[0]?['Timestamp'],'dd-MM-yyyy')",
"#formatDateTime(utcNow(),'dd-MM-yyyy')"]
}
Below is the complete flow of my Logic App
RESULTS:
To reproduce the same in your Logic App you can use the below code view
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Condition": {
"actions": {
"Terminate": {
"inputs": {
"runStatus": "Succeeded"
},
"runAfter": {},
"type": "Terminate"
}
},
"else": {
"actions": {
"Delay": {
"inputs": {
"interval": {
"count": 2,
"unit": "Hour"
}
},
"runAfter": {},
"type": "wait"
},
"HTTP": {
"inputs": {
"method": "POST",
"uri": "<URI>"
},
"runAfter": {
"Delay": [
"Succeeded"
]
},
"type": "Http"
}
}
},
"expression": {
"and": [
{
"contains": [
"#formatDateTime(body('Parse_JSON')?[0]?['Timestamp'],'dd-MM-yyyy')",
"#formatDateTime(utcNow(),'dd-MM-yyyy')"
]
}
]
},
"runAfter": {
"Parse_JSON": [
"Succeeded"
]
},
"type": "If"
},
"Get_entities_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azuretables']['connectionId']"
}
},
"method": "get",
"path": "/v2/storageAccounts/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/tables/#{encodeURIComponent('<TableName>')}/entities"
},
"runAfter": {},
"type": "ApiConnection"
},
"Parse_JSON": {
"inputs": {
"content": "#body('Get_entities_(V2)')?['value']",
"schema": {
"items": {
"properties": {
"FirstName": {
"type": "string"
},
"LastName": {
"type": "string"
},
"PartitionKey": {
"type": "string"
},
"RowKey": {
"type": "string"
},
"Timestamp": {
"type": "string"
},
"odata.etag": {
"type": "string"
}
},
"required": [
"odata.etag",
"PartitionKey",
"RowKey",
"Timestamp",
"FirstName",
"LastName"
],
"type": "object"
},
"type": "array"
}
},
"runAfter": {
"Get_entities_(V2)": [
"Succeeded"
]
},
"type": "ParseJson"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {
"$connections": {
"value": {
"azuretables": {
"connectionId": "/subscriptions/<SUB_ID>/resourceGroups/<RG>/providers/Microsoft.Web/connections/azuretables",
"connectionName": "azuretables",
"id": "/subscriptions/<SUB_ID>/providers/Microsoft.Web/locations/centralus/managedApis/azuretables"
}
}
}
}
}
Alternatively, you can use Recurrence trigger to trigger it in regular intervals with the same logic.

Listing and viewing contents of Azure Storage containers with Azure Logic Apps?

In Azure a container will be made for each user in Azure Storage, I want to be able to list the container and view the size of the content to ensure it does not exceed a certain limit. Is it possible to do this with Azure Logic Apps? I am not finding functions to do so.
yes, this is possible through logic apps. You can use 'Get Blob Metadata (V2)' to get all the properties of the files and if you are trying to get the content, you can use 'Get blob content (V2)'. To reproduce this I first created 3 containers (i.e., Container1, Container2, and Container3) and uploaded a few files into these containers with different sizes. To get the list of all the containers I have used Lists blobs in the root folder (V2) and used Lists blobs (V2) taking the path from the previous step to iterate blobs inside the containers.
In the next step I'm using Get Blob Metadata (V2) to get the properties of each blob using list blobs path.
Then using Condition action I'm extracting the blobs which are less than 9128 bytes and storing all this data into variables.
Finally, I'm using compose connector to view all the files along with size and path.
RESULT:
You can try using the below code view to test in your environment
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Compose": {
"inputs": "#variables('FilesWithinLimit')",
"runAfter": {
"For_each": [
"Succeeded"
]
},
"type": "Compose"
},
"Compose_2": {
"inputs": "#variables('FilesOutOfLimit')",
"runAfter": {
"For_each": [
"Succeeded"
]
},
"type": "Compose"
},
"FilesOutOfLimit": {
"inputs": {
"variables": [
{
"name": "FilesOutOfLimit",
"type": "array"
}
]
},
"runAfter": {
"FilesWithinLimit": [
"Succeeded"
]
},
"type": "InitializeVariable"
},
"FilesWithinLimit": {
"inputs": {
"variables": [
{
"name": "FilesWithinLimit",
"type": "array"
}
]
},
"runAfter": {},
"type": "InitializeVariable"
},
"For_each": {
"actions": {
"For_each_2": {
"actions": {
"Condition": {
"actions": {
"Append_to_FilesWithinLimit": {
"inputs": {
"name": "FilesWithinLimit",
"value": {
"Name": "#{body('Get_Blob_Metadata_(V2)')?['DisplayName']}",
"Path": "#{body('Get_Blob_Metadata_(V2)')?['Path']}",
"Size": "#{body('Get_Blob_Metadata_(V2)')?['Size']}"
}
},
"runAfter": {},
"type": "AppendToArrayVariable"
}
},
"else": {
"actions": {
"Append_to_FilesOutOfLimit": {
"inputs": {
"name": "FilesOutOfLimit",
"value": {
"Name": "#{body('Get_Blob_Metadata_(V2)')?['DisplayName']}",
"Path": "#{body('Get_Blob_Metadata_(V2)')?['Path']}",
"Size": "#{body('Get_Blob_Metadata_(V2)')?['Size']}"
}
},
"runAfter": {},
"type": "AppendToArrayVariable"
}
}
},
"expression": {
"and": [
{
"lessOrEquals": [
"#body('Get_Blob_Metadata_(V2)')?['Size']",
9128
]
}
]
},
"runAfter": {
"Get_Blob_Metadata_(V2)": [
"Succeeded"
]
},
"type": "If"
},
"Get_Blob_Metadata_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/files/#{encodeURIComponent(encodeURIComponent(items('For_each_2')?['Path']))}"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"foreach": "#body('Lists_blobs_(V2)')?['value']",
"runAfter": {
"Lists_blobs_(V2)": [
"Succeeded"
]
},
"type": "Foreach"
},
"Lists_blobs_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/foldersV2/#{encodeURIComponent(encodeURIComponent(items('For_each')?['Path']))}",
"queries": {
"nextPageMarker": ""
}
},
"runAfter": {},
"type": "ApiConnection"
}
},
"foreach": "#body('Lists_blobs_in_the_root_folder__(V2)')?['value']",
"runAfter": {
"Lists_blobs_in_the_root_folder__(V2)": [
"Succeeded"
]
},
"type": "Foreach"
},
"Lists_blobs_in_the_root_folder__(V2)": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/foldersV2",
"queries": {
"nextPageMarker": "",
"useFlatListing": false
}
},
"runAfter": {
"FilesOutOfLimit": [
"Succeeded"
]
},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {
"$connections": {
"value": {
"azureblob": {
"connectionId": "/subscriptions/<Your_SUBSCRIPTION_ID>/resourceGroups/<YOUR_RESOURCE_GROUP>/providers/Microsoft.Web/connections/azureblob",
"connectionName": "azureblob",
"id": "/subscriptions/<Your_SUBSCRIPTION_ID>/providers/Microsoft.Web/locations/centralus/managedApis/azureblob"
}
}
}
}
}

Azure Logic App HTTP Action step - dynamically get endOfDate date

i have an azure logic app with recurrence that will call api endpoint every midnight, im passing in two date properties in my request body that will include start of day and end of day.
Logic app has expression startOfDay() however they dont have endOfDay(), how can I dynamically get end of day in UTC format like startOfDay() does?
Thanks
this is how my request body looks like but its also complaining about #startOfDay()
{
"organizationId": 'f41186b0-7f09-42c5-8a9d-81a2ad2b0e61',
"attemptedDeliveries": true,
"cancelDateStart": #{startOfDay()},
"cancelDateEnd": ""
}
There is no direct expression for endOfDay but one of the workarounds is to addToTime and 'subtractFromTime' from startOfDay to get the endOfDay. Consider I'm taking the timestamp to be UtcNow() and to calculate the endOfDay I'm using the below expression.
subtractFromTime(addToTime(outputs('startOfDay'),1,'Day','o'),1,'Second','yyyy-MM-ddTHH:mm:ss')
I'm using Parse Json in order to retrieve the inner Json details for future use. By doing this, you can have a custom JSON created using Compose() connector.
Result:-
Codeview
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Compose": {
"inputs": {
"attemptedDeliveries": "#body('Parse_JSON')?['attemptedDeliveries']",
"cancelDateEnd": "#{outputs('endOfDay')}",
"cancelDateStart": "#{outputs('startOfDay')}",
"organizationId": "#{body('Parse_JSON')?['organizationId']}"
},
"runAfter": {
"endOfDay": [
"Succeeded"
]
},
"type": "Compose"
},
"Parse_JSON": {
"inputs": {
"content": "#triggerBody()",
"schema": {
"properties": {
"attemptedDeliveries": {
"type": "boolean"
},
"cancelDateEnd": {
"type": "string"
},
"cancelDateStart": {
"type": "string"
},
"organizationId": {
"type": "string"
}
},
"type": "object"
}
},
"runAfter": {},
"type": "ParseJson"
},
"endOfDay": {
"inputs": "#subtractFromTime(addToTime(startOfDay(utcNow()),1,'Day','o'),1,'Second','yyyy-MM-ddTHH:mm:ss')",
"runAfter": {
"startOfDay": [
"Succeeded"
]
},
"type": "Compose"
},
"startOfDay": {
"inputs": "#startOfDay(utcNow(),'yyyy-MM-ddTHH:mm:ss')",
"runAfter": {
"Parse_JSON": [
"Succeeded"
]
},
"type": "Compose"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {}
}
Here is the json that I'm receiving from my body of Http trigger
{
"organizationId": "f41186b0-7f09-42c5-8a9d-81a2ad2b0e61",
"attemptedDeliveries": true,
"cancelDateStart": "",
"cancelDateEnd": ""
}
Updated Answer
After the follow up here my logic app
Result:
Codeview
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"endOfDay": {
"inputs": "#subtractFromTime(addToTime(startOfDay(utcNow()),1,'Day','o'),1,'Second','yyyy-MM-ddTHH:mm:ss')",
"runAfter": {
"startOfDay": [
"Succeeded"
]
},
"type": "Compose"
},
"startOfDay": {
"inputs": "#startOfDay(utcNow(),'yyyy-MM-ddTHH:mm:ss')",
"runAfter": {},
"type": "Compose"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"Recurrence": {
"evaluatedRecurrence": {
"frequency": "Second",
"interval": 30
},
"recurrence": {
"frequency": "Second",
"interval": 30
},
"type": "Recurrence"
}
}
},
"parameters": {}
}
After endOfDay connector you can add 4 parallel HTTP triggers and add logic to it.
REFERENCES: Reference guide to workflow expression functions in Azure Logic Apps and Power Automate

Azure Logic app how to append list blobs to array variable?

Hi I am working on azure logic app. I have below array variable. These are the mail folder path and inside I have files.
["/mycontainer/PreDesign/1e36d504-7876-41b1-89b3-83d2132fa7c4/AdditionalDocumets","/mycontainer/PreDesign/1e36d504-7876-41b1-89b3-83d2132fa7c4/TowerCalcOutPut","/mycontainer/PreDesign/1e36d504-7876-41b1-89b3-83d2132fa7c4/TowerDataSheet"]
Then I have below method to list the blobs
Here blob list is array variable as defined above. Then I have added listblobs which will loop through each path defined in array variable and lists blobs and I want to append blobs to array variable.
Here in append array variable I am able to append only blobs available inside first array element that is /containername/PreDesign/1e36d504-7876-41b1-89b3-83d2132fa7c4/AdditionalDocumets
I am not able to append blobs which are inside mycontainer/PreDesign/1e36d504-7876-41b1-89b3-83d2132fa7c4/TowerCalcOutPut","/mycontainer/PreDesign/1e36d504-7876-41b1-89b3-83d2132fa7c4/TowerDataSheet, only first element blobs I am able to append it to array variable. I am struggling to append all the blobs to array variable. Can someone help me where exactly I am missing? Any help would be appreciated. Thank you
I am struggling to append all the blobs to array variable. Can someone help me where exactly I am missing?
Its because the flow goes into only the first folder but not all folders.
Here is one of the workaround that you can try. Like said in How to attach multiple blobs in logic app from different folder just try adding Append to array variable at the end of For each 2 and you will have paths for all the blobs in your variable. Below is the screenshot of my logic app for your reference.
output
Here is the code view of my logic app
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Compose": {
"inputs": "#variables('BlobList')",
"runAfter": {
"For_each": [
"Succeeded"
]
},
"type": "Compose"
},
"For_each": {
"actions": {
"For_each_2": {
"actions": {
"For_each_3": {
"actions": {
"Append_to_array_variable": {
"inputs": {
"name": "BlobList",
"value": "#items('For_each_3')?['Path']"
},
"runAfter": {},
"type": "AppendToArrayVariable"
}
},
"foreach": "#body('Lists_blobs_in_Directory')?['value']",
"runAfter": {
"Lists_blobs_in_Directory": [
"Succeeded"
]
},
"type": "Foreach"
},
"Lists_blobs_in_Directory": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/foldersV2/#{encodeURIComponent(encodeURIComponent(items('For_each_2')?['Path']))}",
"queries": {
"nextPageMarker": ""
}
},
"runAfter": {},
"type": "ApiConnection"
}
},
"foreach": "#body('Lists_Directories_inside_Container')?['value']",
"runAfter": {
"Lists_Directories_inside_Container": [
"Succeeded"
]
},
"type": "Foreach"
},
"Lists_Directories_inside_Container": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/foldersV2/#{encodeURIComponent(encodeURIComponent(items('For_each')?['Path']))}",
"queries": {
"nextPageMarker": ""
}
},
"runAfter": {},
"type": "ApiConnection"
}
},
"foreach": "#body('Lists_Containers_in_root_folder')?['value']",
"runAfter": {
"Lists_Containers_in_root_folder": [
"Succeeded"
]
},
"type": "Foreach"
},
"Initialize_BlobList_variable": {
"inputs": {
"variables": [
{
"name": "BlobList",
"type": "array"
}
]
},
"runAfter": {},
"type": "InitializeVariable"
},
"Lists_Containers_in_root_folder": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/foldersV2",
"queries": {
"nextPageMarker": "",
"useFlatListing": false
}
},
"runAfter": {
"Initialize_BlobList_variable": [
"Succeeded"
]
},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {
"$connections": {
"value": {
"azureblob": {
"connectionId": "/subscriptions/<YOUR_SUBSCRIPTION_ID>/resourceGroups/<YOUR_RESOURCE_GROUP>/providers/Microsoft.Web/connections/azureblob",
"connectionName": "azureblob",
"id": "/subscriptions/<YOUR_SUBSCRIPTION_ID>/providers/Microsoft.Web/locations/northcentralus/managedApis/azureblob"
}
}
}
}
}

Send Email with multiple attachment using Azure Logic App

I need to send the blobs uploaded to my Azure storage container as an attachments. Number of files getting uploaded to container will change so I need to use dynamic method for attachment.
I have verified this question related to it
I am using below logic:
Append to variable values
{
"Name": items('For_each')?['DisplayName']
"ContentBytes":body('Get_blob_content')
}
When I am trying to save the logic, getting below error:
Save logic app failed
Failed to save logic app testing. The template validation failed: 'The action(s) 'Get_blob_content' referenced by 'inputs' in action 'Append_to_array_variable' are not defined in the template.'.
How can I solve this ?
Based on the error message shared above, Instead of saving the entire workflow at once would suggest you to save the logic app at each stage or before the appendtoarray variable stage & post then append the values to attachment variable with previous stage outputs.
Based on the above requirement, we have created the below logic app in our local environment &tested it as well which is working fine.
In our workflow, We have Used For Each to loop the blobs from List Blobs action. Within For Each you can use Get blob content to get blob content, and then use Append to array variable to append attachments.
The expressions Name and ContentBytes are as follows:
"ContentBytes": "#base64(body('Get_blob_content_(V2)'))",
"Name": "#items('For_each')?['DisplayName']"
Here is the code view of the Logic app that we have created :
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each": {
"actions": {
"Append_to_array_variable": {
"inputs": {
"name": "attachments",
"value": {
"ContentBytes": "#base64(body('Get_blob_content_(V2)'))",
"Name": "#items('For_each')?['DisplayName']"
}
},
"runAfter": {
"Get_blob_content_(V2)": [
"Succeeded"
]
},
"type": "AppendToArrayVariable"
},
"Get_blob_content_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/files/#{encodeURIComponent(encodeURIComponent(items('For_each')?['Path']))}/content",
"queries": {
"inferContentType": true
}
},
"runAfter": {},
"type": "ApiConnection"
}
},
"foreach": "#body('Lists_blobs_(V2)')?['value']",
"runAfter": {
"Initialize_variable": [
"Succeeded"
]
},
"type": "Foreach"
},
"Initialize_variable": {
"inputs": {
"variables": [
{
"name": "attachments",
"type": "array"
}
]
},
"runAfter": {
"Lists_blobs_(V2)": [
"Succeeded"
]
},
"type": "InitializeVariable"
},
"Lists_blobs_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/foldersV2/#{encodeURIComponent(encodeURIComponent('JTJmcmVwb3J0cw=='))}",
"queries": {
"nextPageMarker": "",
"useFlatListing": false
}
},
"metadata": {
"JTJmcmVwb3J0cw==": "/reports"
},
"runAfter": {},
"type": "ApiConnection"
},
"Send_an_email_(V2)": {
"inputs": {
"body": {
"Attachments": "#variables('attachments')",
"Body": "<p>tested logic app flow successfully</p>",
"Subject": "blob test",
"To": "<username>#microsoft.com"
},
"host": {
"connection": {
"name": "#parameters('$connections')['office365']['connectionId']"
}
},
"method": "post",
"path": "/v2/Mail"
},
"runAfter": {
"For_each": [
"Succeeded"
]
},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"When_a_blob_is_added_or_modified_(properties_only)_(V2)": {
"evaluatedRecurrence": {
"frequency": "Minute",
"interval": 1
},
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/triggers/batch/onupdatedfile",
"queries": {
"checkBothCreatedAndModifiedDateTime": false,
"folderId": "JTJmcmVwb3J0cw==",
"maxFileCount": 10
}
},
"metadata": {
"JTJmcmVwb3J0cw==": "/reports"
},
"recurrence": {
"frequency": "Minute",
"interval": 1
},
"splitOn": "#triggerBody()",
"type": "ApiConnection"
}
}
},
"parameters": {
"$connections": {
"value": {
"azureblob": {
"connectionId": "/subscriptions/<sub-ID>/resourceGroups/<resourceGroup>/providers/Microsoft.Web/connections/azureblob",
"connectionName": "azureblob",
"id": "/subscriptions/<sub-id>/providers/Microsoft.Web/locations/eastus/managedApis/azureblob"
},
"office365": {
"connectionId": "/subscriptions/<sub-id>/resourceGroups/<resroucegroup>/providers/Microsoft.Web/connections/office365",
"connectionName": "office365",
"id": "/subscriptions/<sub-id>/providers/Microsoft.Web/locations/eastus/managedApis/office365"
}
}
}
}
}
Here is the sample Output for reference:

Resources