Last active
September 21, 2016 23:36
-
-
Save marckean/6dfe901ff11586a655cc9a26cc0d5847 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
workflow StopAzurePlaylistVMs | |
{ | |
$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) | |
{ | |
Stop-AzureRmVM -Name $VM.Name -ResourceGroupName $VM.ResourceGroupName -Force | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment