Starting Azure Vm in parallel with runbook throws InvalidOperationException -


i'm trying use azure runbooks start virtual machines specified tag. use powershell workflow can start them parallel.

the code below works, have problem starting 1 random virtual machine. exception:

start-azurermvm : collection modified; enumeration operation may not execute.

categoryinfo : closeerror: (:) [start-azurermvm], invalidoperationexception

i thought $taggedresourceslist = @($resources) enumerate list , make modifications allowed?

workflow startupparallel  {      $resources = find-azurermresource -tagname startup -tagvalue prework     $taggedresourceslist = @($resources)      foreach -parallel ( $vm in $taggedresourceslist )      {         if($vm.resourcetype -eq "microsoft.compute/virtualmachines")          {             start-azurermvm -resourcegroupname $vm.resourcegroupname -name $vm.name             }     } } 

has else had problem?


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -