Skip to content

Instantly share code, notes, and snippets.

@geralexgr
Last active November 19, 2022 06:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save geralexgr/8114105fa3c359a247ce75981626d74f to your computer and use it in GitHub Desktop.
Save geralexgr/8114105fa3c359a247ce75981626d74f to your computer and use it in GitHub Desktop.
trigger: none
pr: none
parameters:
- name: vms
type: object
default: ["ubuntu1","windows-1"]
pool:
vmImage: ubuntu-latest
jobs:
- job: startvmjob
displayName: Start VMs
steps:
- checkout: none
- ${{ each vm in parameters.vms }}:
- task: AzureCLI@2
displayName: starting vm ${{vm}}
inputs:
azureSubscription: 'Azure Subscription Service Connection'
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
$vmrequest = az vm list | ConvertFrom-Json | Where-Object {$_.Name -Match "${{vm}}"}
az vm start --resource-group $vmrequest.resourcegroup --name $vmrequest.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment