Skip to content

Instantly share code, notes, and snippets.

@ebibibi
Last active August 29, 2015 14:25
Show Gist options
  • Select an option

  • Save ebibibi/b6b0c1ce51f42e9548a6 to your computer and use it in GitHub Desktop.

Select an option

Save ebibibi/b6b0c1ce51f42e9548a6 to your computer and use it in GitHub Desktop.
workflow StopAllVMs
{
$azureCredential = Get-AutomationPSCredential -Name "Default Automation Credential"
# Connect to Azure
Add-AzureAccount -Credential $azureCredential | Write-Verbose
# Select the Azure subscription
$SubscriptionName = 'xxx Subscription Name xxx'
Select-AzureSubscription -SubscriptionName $SubscriptionName
Write-Output "-------------------------------------------------------------------------"
Write-Output "Starting the Shutdown NOW!"
Get-AzureVM | Stop-AzureVM -Force
Write-Output "-------------------------------------------------------------------------"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment