In the logic app , is it possible to get file content from csv file stored in a storage blob and used the columns (value) of csv in the powershell runbook(automation account)

Azure-learning 56 Reputation points
2022-09-01T13:25:51.917+00:00

logic app with automation runbook . I have a automation run book which takes data from a csv file from storage file. but it's sequential using for each loop in powershell.
I found that in logic app we can use for each for parallel execution .

I am trying implement || execution using logic app so that I can run for-each loop in the content of csv file from blob and automation runbook can use the values as parameter and powershell script can use that value (vm name , rg passed in csv file) .

sequence should be --
Blob file --check vm name , rg value from the csv file (which has multiple unique records of vm) --> automation run book (powershell script ) takes the input of RG,VM name from above step and pass in the shell script as input --> || execution of script using for-each loop for multiple VM

at moment ,This is how i have added csv file in runbook to get vm data.
$storageAccountObj = Get-AzStorageAccount -Name "" -ResourceGroupName ""
$context = $storageAccountObj.Context
$readvalues = Get-AzStorageBlobContent -Container "" -Blob "" -Context $context -Force

$value=$readvalues.Name

$vmdata= Import-Csv -Path $value

$vmdata.ResourceGroupName , $vmdata.VMName

We need to update the logic to get csv file content . Please help us if this case is possible where we can get file content and use in automation runbook

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,829 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,111 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 68,391 Reputation points
    2022-09-14T05:39:30.197+00:00

    @NGaur-3476 Thanks for reaching out and apology for the delay. Unfortunately, there are no connector that can help you to read the CSV file line by line.
    To get the file from storage account you can leverage the Get Blob Content (V2) action that will return the file content as binary. Once you have the binary content you can offload this (to get the file content or in json format) functionality (using your custom logic) to Azure function and get the desired result as per your need. Alternative you can refer to this github repo (not the official repro) that could help you.

    Once you have the content as the JSON object you can iterate through the loop and leverage the Create Job action inside the forloop with the dynamic content (json object) as the body parameter that you can pass to your automation runbook.

    0 comments No comments