Last active
September 23, 2016 01:23
-
-
Save marckean/e49d90e0ac74e65d729e55c1088df1c5 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 Startup_VM | |
{ | |
$Cred = Get-AutomationPSCredential -Name "Credential_Name" | |
$tenant = Get-AutomationVariable -Name "tenant" | |
Login-AzureRmAccount -Credential $Cred -ServicePrincipal -TenantId $tenant | |
$subscription = Get-AutomationVariable -Name "subscription" | |
Select-AzureRmSubscription -SubscriptionName $subscription | |
$VMs = Get-AzureRmVM | where {$_.Name -match 'Virtual_Machine_Name'} | |
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