Skip to content

Instantly share code, notes, and snippets.

@marckean
Created September 21, 2016 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marckean/c6bd0975b93959aec362f56d656686cd to your computer and use it in GitHub Desktop.
Save marckean/c6bd0975b93959aec362f56d656686cd to your computer and use it in GitHub Desktop.
workflow StartAzurePlaylistVMs
{
$Cred = Get-AutomationPSCredential -Name "PowerShell SvcAcct"
Login-AzureRmAccount -Credential $Cred
$subscription = Get-AutomationVariable -Name "subscription"
Select-AzureRmSubscription -SubscriptionName $subscription
$VMs = Get-AzureRmVM | where {$_.Name -match 'playlist'}
ForEach -Parallel ($VM in $VMs)
{
Start-AzureRmVM -Name $VM.Name -ResourceGroupName $VM.ResourceGroupName
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment