How to run script through runbook in a vm , parallely without timelimit and waiting for one to finish

sabhyata rawat 0 Reputation points
2024-03-26T07:57:33.03+00:00

I want to run a bash script in my vm - parallely , currently I am using invoke command which is failing. I have tried- Invoke-AzVMRunCommand -ResourceGroupName $AZURE_VM_RG_NAME -VMName $AZURE_VM_NAME -CommandId 'RunShellScript' -ScriptString $full_backup_scriptString

and

#Set-AzVMRunCommand -ResourceGroupName "myRG" -VMName "myVM" -Location "EastUS" -RunCommandName "RunCommandName" –SourceScript "echo Hello World!"
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,013 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Andriy Bilous 11,821 Reputation points MVP Volunteer Moderator
    2024-03-29T21:16:56.31+00:00

    Hello sabhyata rawat

    You can create a new Azure Automation PowerShell runbook, which will host the script you are going to run in parallel on a schedule with use of the “-parallel” parameter
    https://www.thomasmaurer.ch/2022/08/schedule-and-run-powershell-scripts-for-azure-vms-using-azure-automation/

    With PowerShell Workflow runbook and can use the ForEach -Parallel construct to process commands for each item in a collection concurrently. For more information with regards to it, please refer this Azure document.
    https://learn.microsoft.com/en-us/answers/questions/637362/running-vms-in-parallel-in-azure-runbook

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.