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
Post a Comment