Reputation: 14898
I have a line of business app that I want to deploy to Windows Azure. The app is only needed during office ours so to save on costs I want to turn the Azure Website on and off outside of business hours.
How is this achievable?
Upvotes: 1
Views: 956
Reputation: 11256
You can do this using Azure Automation (currently in preview). To do this,
Create a Runbook to Start the website. For example,
workflow StartContosoWebsite
{
$cred = Get-AutomationPSCredential -Name "[email protected]"
Add-AzureAccount -Credential $cred
InlineScript {
Select-AzureSubscription -SubscriptionName "MCT"
Start-AzureWebsite -Name "contoso-web"
}
}
Create a Runbook to Stop the website. For example,
workflow StopContosoWebsite
{
$cred = Get-AutomationPSCredential -Name "[email protected]"
Add-AzureAccount -Credential $cred
InlineScript {
Select-AzureSubscription -SubscriptionName "MCT"
Stop-AzureWebsite -Name "contoso-web"
}
}
Create an Asset in your automation account for the credentials you use in your runbooks to start and stop the web site. For example,
Then, for each runbook, define the schedule you want it to run on. For your scenario, you would want to define a Daily schedule to run every 7 days. Using the example above, the StartContosoWebsite would run on Monday morning at some time you specify. The StopContosoWebsite would run on Friday eventing at some time you specify.
Upvotes: 3