Created
December 11, 2015 19:39
-
-
Save fabriciosanchez/57f3ae2f598a5c48d115 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 StartVM | |
{ | |
Param ( | |
[parameter(Mandatory=$true)] | |
[String] | |
$VMName, | |
[parameter(Mandatory=$true)] | |
[String] | |
$ServiceName | |
) | |
$day = (Get-Date).DayOfWeek | |
if ($day -eq 'Saturday' -or $day -eq 'Sunday'){ | |
exit | |
} | |
$subscriptionName = Get-AutomationVariable -Name "SubscriptionName" | |
$subscriptionID = Get-AutomationVariable -Name "SubscriptionId" | |
$certificateName = Get-AutomationVariable -Name "CertificateName" | |
$certificate = Get-AutomationCertificate -Name $certificateName | |
Set-AzureSubscription -SubscriptionName $subscriptionName -SubscriptionId $subscriptionID -Certificate $certificate | |
Select-AzureSubscription $subscriptionName | |
Start-AzureVM -Name $VMName -ServiceName $ServiceName | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment