你如何开启和关闭的时间表把一个Azure的网站? [英] How do you turn an Azure Website on and off on a schedule?

查看:139
本文介绍了你如何开启和关闭的时间表把一个Azure的网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有商业应用的一条线,我要部署到Windows Azure。办公室里时,才需要该应用程序让我们节省成本,我想打开Azure的网站和关闭的时间之外。

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.

这是如何实现的?

推荐答案

您可以做到这一点使用Azure的自动化(目前在preVIEW)。要做到这一点,

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 "rick@cloudalloc.com"

    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 "rick@cloudalloc.com"

    Add-AzureAccount -Credential $cred

    InlineScript {

        Select-AzureSubscription -SubscriptionName "MCT"

        Stop-AzureWebsite -Name "contoso-web"  
    }
}

在自动化帐户您在运行手册用来启动和停止网站的凭据创建的资产即可。例如,

然后,对于每个运行手册,定义你希望它运行的时间表。对于您的情况,你会希望定义一个每日时间表运行的每7天即可。使用上面的例子中,StartContosoWebsite将在一段时间内,你指定在周一上午运行。该StopContosoWebsite将在一段时间内指定上周五三项赛运行。

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.

这篇关于你如何开启和关闭的时间表把一个Azure的网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆