powershell - Azure Automation: Parallel Job Handling (start-job) -
i'm trying convert azure powershell script azure automation runbook, i've run issue when using "start-job" command. after inline scripts called, jobs fail shortly after starting. seems me parameters not passing through properly.
is there i'm missing pass parameters within azure automation?
the commands failing:
$createvnetgateway = { param($vnetname) new-azurevnetgateway -vnetname $vnetname -gatewaytype dynamicrouting } <#start jobs#> start-job $createvnetgateway -argumentlist $vnetname1 start-job $createvnetgateway -argumentlist $vnetname2 wait-job *
in powershell workflow, when pass value inlinescript block, need add $using front of value. ex:
workflow foo { $message = "hi" inlinescript { write-output -inputobject $using:message } }
in addition, starting other jobs within azure automation sandbox not supported. looks trying run 2 tasks in parallel , after both complete. powershell workflow (the language / engine azure automation runbooks run on) has parallel keyword can used this:
workflow bar { parallel { new-azurevnetgateway -vnetname $vnetname1 -gatewaytype dynamicrouting new-azurevnetgateway -vnetname $vnetname2 -gatewaytype dynamicrouting } # happens after both of complete }
Comments
Post a Comment