
I am busy working on a flow which exports data for assets from ServiceNow. I then use the Azure Create Job from the Azure Automation actions to pass the information to a runbook in Azure which runs a PowerShell script to configure the items for me.
The overall flow is working but I am looking for a way to optimize the PowerShell script execution portion of the flow. Currently the Azure Automation create job action runs in a Apply to Each action which causes the PowerShell job to trigger a separate job for each asset exported from ServiceNow which takes about 2 minutes to complete per item.
I am trying get all assets exported from ServiceNow into a variable which can be passed to PowerShell and have the PowerShell execute using a ForEach loop as you would do when using a CSV file for bulk configurations in PowerShell.
I was able to get all the data into a CSV table and also tried in a variable, but the data gets passed as a single string to the Azure job instead of a header with rows of values.