You can create an array of Hashtables in PowerShell like this:
$prepTables = @{'prepTable' = 'test_1_ddl'}, @{'prepTable' = 'test_2_ddl'}
Then you can use it in a loop like:
$prepTables = @{'prepTable' = 'test_1_ddl'}, @{'prepTable' = 'test_2_ddl'}
$result = $prepTables | ForEach-Object {
# the $_ Automatic variable represents a single item (hashtable) from the aray
Invoke-AzDataFactoryV2Pipeline -ResourceGroupName $rg_nm -DataFactoryName $adf_nm -PipelineName 'pl_common_Table_Creation_updated' -Parameter $_
}
Personally, I hate those long code lines, so try using Splatting
$prepTables = @{'prepTable' = 'test_1_ddl'}, @{'prepTable' = 'test_2_ddl'}
$result = $prepTables | ForEach-Object {
$splatParams = @{
ResourceGroupName = $rg_nm
DataFactoryName = $adf_nm
PipelineName = 'pl_common_Table_Creation_updated'
Parameter = $_ # the $_ Automatic variable represents a single item (hashtable) from the aray
}
Invoke-AzDataFactoryV2Pipeline @splatParams
}
P.S. I'm assuming here that your $(rg_nm)
and $(adf_nm)
are just placeholders for the real ResourceGroupName and DataFactoryName.
The code above uses variables for those.