Azure logic Apps, After a bicep deployment i have to reselect the blob storage account to list the containers and select the container i want
Azure logic Apps, After a Azure logic apps bicep deployment, i have to reselect the blob storage account to list the containers and select the container i want to trigger the blob trigger action ? any reason i have to this ?
Azure Logic Apps
-
Dan Rios 1,985 Reputation points • MVP
2024-06-18T08:59:08.0433333+00:00 Can you post your Bicep template, it may help us understand this better. My understanding is the blob connector is asking you to select the pre-defined the options, post deployment, even though your Bicep template contains the relevant information already?
-
Vikram Pottam 0 Reputation points
2024-06-18T18:24:07.2266667+00:00 param region_location string
param workflows_FileProcess_name string
param v_az_func_url string
param v_staging_account string
param v_staging_container string
param v_subscription_id string
param v_destination_container string
param v_destination_acc_name string
param v_integration_acc string
param teams_url string
param v_resource_group string
param integrationAccounts_sftp_listener_externalid string = '/subscriptions/${v_subscription_id}/resourceGroups/${v_resource_group}/providers/Microsoft.Logic/integrationAccounts/${v_integration_acc}'
param connections_azureblob_9_externalid string = '/subscriptions/${v_subscription_id}/resourceGroups/${v_resource_group}/providers/Microsoft.Web/connections/azureblob'
param connections_azureblob_10_externalid string = '/subscriptions/${v_subscription_id}/resourceGroups/${v_resource_group}/providers/Microsoft.Web/connections/datalake'
resource workflows_FileProcess_name_resource 'Microsoft.Logic/workflows@2017-07-01' = {
name: workflows_FileProcess_name
location: region_location
properties: {
state: 'Enabled' integrationAccount: { id: integrationAccounts_sftp_listener_externalid } definition: { '$schema': 'https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#' contentVersion: '1.0.0.0' parameters: { checkBothCreatedAndModifiedDateTime: { defaultValue: true type: 'Bool' } '$connections': { defaultValue: {} type: 'Object' } } triggers: { 'When_a_blob_is_added_or_modified_(properties_only)_(V2)': { recurrence: { interval: 3 frequency: 'Second' timeZone: 'Central Standard Time' } evaluatedRecurrence: { interval: 3 frequency: 'Second' timeZone: 'Central Standard Time' } type: 'ApiConnection' inputs: { host: { connection: { name: '@parameters(\'$connections\')[\'azureblob\'][\'connectionId\']' } } method: 'get' path: '/v2/datasets/@{encodeURIComponent(encodeURIComponent(\'${v_staging_account}\'))}/triggers/batch/onupdatedfile' queries: { folderId: v_staging_container maxFileCount: 10 checkBothCreatedAndModifiedDateTime: false } } } } actions: { For_each_flle: { foreach: '@triggerBody()' actions: { Log_FileName: { runAfter: { fileName: [ 'Succeeded' ] } type: 'Http' inputs: { uri: 'https://dc.services.visualstudio.com/v2/track' method: 'POST' headers: { 'Content-Type': 'application/json' } body: { data: { baseData: { name: 'Antivirus Scan' properties: { FileRouter_FileName: '@{outputs(\'fileName\')}' } ver: 2 } baseType: 'EventData' } iKey: '96bec26d-794b-4173-baa9-b93e11660c72' name: 'Microsoft.ApplicationInsights.Event' time: '@{utcNow()}' } } } check_if_its_a_zip_file: { actions: { Log_DB_Output_copy: { type: 'Http' inputs: { uri: 'https://dc.services.visualstudio.com/v2/track' method: 'POST' headers: { 'Content-Type': 'application/json' } body: { data: { baseData: { name: 'Antivirus Scan' properties: { LogDBOutput: 'Zip file: Name: @{items(\'For_each_flle\')}' } ver: 2 } baseType: 'EventData' } iKey: '96bec26d-794b-4173-baa9-b93e11660c72' name: 'Microsoft.ApplicationInsights.Event' time: '@{utcNow()}' } } } 'Create_blob_(V2)_copy': { runAfter: { Log_DB_Output_copy: [ 'Succeeded' ] } type: 'ApiConnection' inputs: { host: { connection: { name: '@parameters(\'$connections\')[\'datalake\'][\'connectionId\']' } } method: 'post' body: '@items(\'For_each_flle\')[\'Name\']' headers: { ReadFileMetadataFromServer: true } path: '/v2/datasets/@{encodeURIComponent(encodeURIComponent(\'${v_destination_acc_name}\'))}/files' queries: { folderPath: '@{concat(\'${v_destination_container}\',\'/zipfiles\')}' name: '@items(\'For_each_flle\')[\'Name\']' queryParametersSingleEncoded: true } } runtimeConfiguration: { contentTransfer: { transferMode: 'Chunked' } } } 'Create-Dest-Path-and-move-file_copy': { runAfter: { 'Create_blob_(V2)_copy': [ 'Succeeded' ] } type: 'ApiConnection' inputs: { host: { connection: { name: '@parameters(\'$connections\')[\'datalake\'][\'connectionId\']' } } method: 'post' headers: { ReadFileMetadataFromServer: true } path: '/v2/datasets/@{encodeURIComponent(encodeURIComponent(\'${v_destination_acc_name}\'))}/copyFile' queries: { source: '@{items(\'For_each_flle\')[\'Path\']}' destination: '@{concat(\'${v_destination_container}\',\'/zipfiles\',\'/\',variables(\'fileName\'))}' overwrite: true queryParametersSingleEncoded: true } } } } runAfter: { Log_FileName: [ 'Succeeded' ] } else: { actions: { extract_yyyymm_from_filename: { type: 'JavaScriptCode' inputs: { code: 'function extractYYYMMMFromString(inputString){const regex=/(\\d{4})([_-]?)(\\d{2})\\2(\\d{2})/;const match=inputString.match(regex);const formatDateToUTC=(year,month,day)=>new Date(Date.UTC(year,month-1,day)).toISOString();return match?formatDateToUTC(match[1],match[3],match[4]):new Date().toISOString();}\r\nreturn extractYYYMMMFromString(workflowContext.actions.fileName.outputs)\r\n' } } tryCatch: { actions: { Log_DB_Output: { runAfter: { parse_function_output: [ 'Succeeded' ] } type: 'Http' inputs: { uri: 'https://dc.services.visualstudio.com/v2/track' method: 'POST' headers: { 'Content-Type': 'application/json' } body: { data: { baseData: { name: 'Service Call' properties: { LogDBOutput: '@{outputs(\'azurefunction-call\')}' } ver: 2 } baseType: 'EventData' } iKey: '96bec26d-794b-4173-baa9-b93e11660c72' name: 'Microsoft.ApplicationInsights.Event' time: '@{utcNow()}' } } } 'azurefunction-call': { type: 'Http' inputs: { uri: v_az_func_url method: 'GET' headers: { 'Content-Type': 'application/json' } queries: { action: 'staged' file_path: '@{items(\'For_each_flle\')[\'Name\']}' file_created_timestamp: '@{items(\'For_each_flle\')[\'LastModified\']}' file_size_bytes: '@{items(\'For_each_flle\')[\'Size\']}' file_uuid: '' filename: '@{outputs(\'fileName\')}' inbound_uuid: '' is_file_an_archive_yn: 'false' storage_type_code: 'staged' file_generated_timestamp: '@{body(\'extract_yyyymm_from_filename\')}' container_name: v_staging_container file_location: '@{outputs(\'fileName\')}' } } } parse_function_output: { runAfter: { 'azurefunction-call': [ 'Succeeded' ] } type: 'ParseJson' inputs: { content: '@body(\'azurefunction-call\')' schema: { type: 'object' properties: { processed: { type: 'object' properties: { destinationContainerProcessed: { type: [ 'string' 'null' ] } topicProcessed: { type: [ 'string' 'null' ] } } } raw: { type: 'object' properties: { isExpected: { type: [ 'boolean' 'null' ] } isDuplicate: { type: [ 'boolean' 'null' ] } final_file_name: { type: [ 'string' 'null' ] } isExactDuplicate: { type: [ 'boolean' 'null' ] } destinationPathFromPostges: { type: [ 'string' 'null' ] } topic: { type: [ 'string' 'null' ] } fileindex_uuid: { type: [ 'string' 'null' ] } inboundfile_uuid: { type: [ 'string' 'null' ] } data_source_component_vuid: { type: [ 'string' 'null' ] } errorCode: { type: [ 'string' 'null' 'integer' ] } errorMessage: { type: [ 'string' 'null' ] } } } } } } } } runAfter: { 'archive-path': [ 'Succeeded' ] } type: 'Scope' } 'archive-path': { runAfter: { extract_yyyymm_from_filename: [ 'Succeeded' ] } type: 'JavaScriptCode' inputs: { code: 'function getCurrentDateInYYYYMM() {\r\n const now = new Date();\r\n const year = now.getFullYear();\r\n // Add 1 because JavaScript months are 0-indexed.\r\n const month = (now.getMonth() + 1).toString().padStart(2, \'0\');\r\n return `\${year}\${month}`;\r\n}\r\nreturn getCurrentDateInYYYYMM();' } } } } expression: { and: [ { equals: [ '@toLower(last(split(outputs(\'fileName\'), \'.\')))' 'zip' ] } ] } type: 'If' } fileName: { runAfter: { Set_variable: [ 'Succeeded' ] } type: 'Compose' inputs: '@items(\'For_each_flle\')[\'Name\']' } Set_variable: { type: 'SetVariable' inputs: { name: 'filename' value: '@{items(\'For_each_flle\')[\'Name\']}' } } } runAfter: { Initialize_variable: [ 'Succeeded' ] } type: 'Foreach' } 'isResponseValid-As-False': { runAfter: {} type: 'InitializeVariable' inputs: { variables: [ { name: 'isResponseValid' type: 'boolean' value: false } ] } } Log_Message_Before_posting_error_to_teams: { runAfter: { For_each_flle: [ 'TimedOut' 'Skipped' 'Failed' ] } type: 'Http' inputs: { uri: 'https://dc.services.visualstudio.com/v2/track' method: 'POST' headers: { 'Content-Type': 'application/json' } body: { data: { baseData: { name: 'Failed to move file to Destination path' properties: { 'Failed to Process the File': ' Output : @{outputs(\'azurefunction-call\')}' } ver: 2 } baseType: 'EventData' } iKey: '96bec26d-794b-4173-baa9-b93e11660c72' name: 'Microsoft.ApplicationInsights.Event' time: '@{utcNow()}' } } } Sends_Teams_Message_for_Failure: { runAfter: { Log_Message_Before_posting_error_to_teams: [ 'Succeeded' ] } type: 'Http' inputs: { uri: teams_url method: 'POST' headers: { 'Content-Type': 'application/json' } body: { text: 'Failed to process file - Output +@{triggerBody()?[\'Path\']}' } } runtimeConfiguration: { contentTransfer: { transferMode: 'Chunked' } } } Initialize_variable: { runAfter: { 'isResponseValid-As-False': [ 'Succeeded' ] } type: 'InitializeVariable' inputs: { variables: [ { name: 'filename' type: 'string' } ] } } } outputs: {} } parameters: { '$connections': { value: { 'azureblob': { id: '/subscriptions/${v_subscription_id}/providers/Microsoft.Web/locations/${region_location}/managedApis/azureblob' connectionId: connections_azureblob_9_externalid connectionName: 'azureblob' } 'datalake': { id: '/subscriptions/${v_subscription_id}/providers/Microsoft.Web/locations/${region_location}/managedApis/azureblob' connectionId: connections_azureblob_10_externalid connectionName: 'datalake' } } } }
}
}
-
Dan Rios 1,985 Reputation points • MVP
2024-06-21T08:51:40.2+00:00 Hey. I tested this with a workflow Logic App using the same trigger, and it seems to retain my trigger parameters. I have a few suggestions to solve this:
- Review the container Id & connection strings are correct
- You can verify all the parameter strings are correct by deploying a new (test) Logic App, configure the Blob trigger connector only, then go to Automation > Export Template > Review the parameter connection strings match what you've got in your parameter bicep file:
My example parameter export & template file looks like:
"parameters": { "workflows_laworkflowtestblobcnt2_name": { "defaultValue": "laworkflowtestblobcnt2", "type": "String" }, "connections_azureblob_externalid": { "defaultValue": "/subscriptions/testsubId/resourceGroups/rg-la-test/providers/Microsoft.Web/connections/azureblob", "type": "String" } }, "resources": [ { "type": "Microsoft.Logic/workflows", "apiVersion": "2017-07-01", "name": "[parameters('workflows_laworkflowtestblobcnt2_name')]", "location": "uksouth", "properties": { "state": "Enabled", "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": { "When_a_blob_is_added_or_modified_(properties_only)_(V2)": { "recurrence": { "interval": 3, "frequency": "Second", "timeZone": "Central Standard Time" }, "evaluatedRecurrence": { "interval": 3, "frequency": "Second", "timeZone": "Central Standard Time" }, "splitOn": "@triggerBody()", "metadata": { "JTJmdGVzdA==": "/test" }, "type": "ApiConnection", "inputs": { "host": { "connection": { "name": "@parameters('$connections')['azureblob']['connectionId']" } }, "method": "get", "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/triggers/batch/onupdatedfile", "queries": { "folderId": "JTJmdGVzdA==", "maxFileCount": 10, "checkBothCreatedAndModifiedDateTime": false } } } }, "actions": {}, "outputs": {} }, "parameters": { "$connections": { "value": { "azureblob": { "id": "/subscriptions/someSubId/providers/Microsoft.Web/locations/uksouth/managedApis/azureblob", "connectionId": "[parameters('connections_azureblob_externalid')]", "connectionName": "azureblob" } } } } } } ] }
You can find the export option here:
Let me know how you get on.
Sign in to comment