title | description | services | documentationcenter | author | manager | editor | ms.assetid | ms.service | ms.devlang | ms.topic | ms.tgt_pltfrm | ms.workload | ms.date | ms.author |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Schedules in Azure Automation | Microsoft Docs |
Automation schedules are used to schedule runbooks in Azure Automation to start automatically. Describes how to create and manage a schedule in so that you can automatically start a runbook at a particular time or on a recurring schedule. |
automation |
eslesar |
jwhit |
tysonn |
1c2da639-ad20-4848-920b-88e471b2e1d9 |
automation |
na |
article |
na |
infrastructure-services |
09/29/2017 |
magoedte |
To schedule a runbook in Azure Automation to start at a specified time, you link it to one or more schedules. A schedule can be configured to either run once or on a reoccurring hourly or daily schedule for runbooks in the Azure classic portal and for runbooks in the Azure portal, you can also schedule them for weekly, monthly, specific days of the week or days of the month, or a particular day of the month. A runbook can be linked to multiple schedules, and a schedule can have multiple runbooks linked to it.
Note
Schedules do not currently support Azure Automation DSC configurations.
The cmdlets in the following table are used to create and manage schedules with Windows PowerShell in Azure Automation. They ship as part of the Azure PowerShell module.
Cmdlets | Description |
---|---|
Azure Resource Manager cmdlets | |
Get-AzureRmAutomationSchedule | Retrieves a schedule. |
New-AzureRmAutomationSchedule | Creates a new schedule. |
Remove-AzureRmAutomationSchedule | Removes a schedule. |
Set-AzureRmAutomationSchedule | Sets the properties for an existing schedule. |
Get-AzureRmAutomationScheduledRunbook | Retrieves scheduled runbooks. |
Register-AzureRmAutomationScheduledRunbook | Associates a runbook with a schedule. |
Unregister-AzureRmAutomationScheduledRunbook | Dissociates a runbook from a schedule. |
Azure Service Management cmdlets | |
Get-AzureAutomationSchedule | Retrieves a schedule. |
New-AzureAutomationSchedule | Creates a new schedule. |
Remove-AzureAutomationSchedule | Removes a schedule. |
Set-AzureAutomationSchedule | Sets the properties for an existing schedule. |
Get-AzureAutomationScheduledRunbook | Retrieves scheduled runbooks. |
Register-AzureAutomationScheduledRunbook | Associates a runbook with a schedule. |
Unregister-AzureAutomationScheduledRunbook | Dissociates a runbook from a schedule. |
You can create a new schedule for runbooks in the Azure portal, in the classic portal, or with Windows PowerShell. You also have the option of creating a new schedule when you link a runbook to a schedule using the Azure classic or Azure portal.
Note
Azure Automation uses the latest modules in your Automation account when a new scheduled job is run. To avoid impacting your runbooks and the processes they automate, you should first test any runbooks that have linked schedules with an Automation account dedicated for testing. This validates your scheduled runbooks continue to work correctly and if not, you can further troubleshoot and apply any changes required before migrating the updated runbook version to production.
Your Automation account does not automatically get any new versions of modules unless you have updated them manually by selecting the Update Azure Modules option from the Modules
.
- In the Azure portal, from your automation account, select Schedules under the section Shared Resources on the left.
- Click Add a schedule at the top of the page.
- On the New schedule pane, type a Name and optionally a Description for the new schedule.
- Select whether the schedule runs one time, or on a reoccurring schedule by selecting Once or Recurrence. If you select Once specify a Start time and then click Create. If you select Recurrence, specify a Start time and the frequency for how often you want the runbook to repeat - by hour, day, week, or by month. If you select week or month from the drop-down list, the Recurrence option appears in the pane and upon selection, the Recurrence option pane is presented and you can select the day of week if you selected week. If you selected month, you can choose by weekdays or specific days of the month on the calendar and finally, do you want to run it on the last day of the month or not and then click OK.
- In the Azure classic portal, select Automation and then select the name of an Automation account.
- Select the Assets tab.
- At the bottom of the window, click Add Setting.
- Click Add Schedule.
- Type a Name and optionally a Description for the new schedule. Your schedule can run One Time, Hourly, Daily, Weekly, or Monthly.
- Specify a Start Time and other options depending on the type of schedule that you selected.
You can use the New-AzureAutomationSchedule cmdlet to create a new schedule in Azure Automation for classic runbooks, or New-AzureRmAutomationSchedule cmdlet for runbooks in the Azure portal. You must specify the start time for the schedule and the frequency it should run.
The following sample commands show how to create a schedule for the 15th and 30th of every month using an Azure Resource Manager cmdlet.
$automationAccountName = "MyAutomationAccount"
$scheduleName = "Sample-MonthlyDaysOfMonthSchedule"
New-AzureRMAutomationSchedule –AutomationAccountName $automationAccountName –Name `
$scheduleName -StartTime "7/01/2016 15:30:00" -MonthInterval 1 `
-DaysOfMonth Fifteenth,Thirtieth -ResourceGroupName "ResourceGroup01"
The following sample commands show how to create a new schedule that runs each day at 3:30 PM starting on January 20, 2015 with an Azure Service Management cmdlet.
$automationAccountName = "MyAutomationAccount"
$scheduleName = "Sample-DailySchedule"
New-AzureAutomationSchedule –AutomationAccountName $automationAccountName –Name `
$scheduleName –StartTime "1/20/2016 15:30:00" –DayInterval 1
A runbook can be linked to multiple schedules, and a schedule can have multiple runbooks linked to it. If a runbook has parameters, then you can provide values for them. You must provide values for any mandatory parameters and may provide values for any optional parameters. These values are used each time the runbook is started by this schedule. You can attach the same runbook to another schedule and specify different parameter values.
- In the Azure portal, from your automation account, select Runbooks under the section Process Automation on the left.
- Click on the name of the runbook to schedule.
- If the runbook is not currently linked to a schedule, then you are offered the option to create a new schedule or link to an existing schedule.
- If the runbook has parameters, you can select the option Modify run settings (Default:Azure) and the Parameters pane is presented where you can enter the information accordingly.
- In the Azure classic portal, select Automation and then click the name of an Automation account.
- Select the Runbooks tab.
- Click on the name of the runbook to schedule.
- Click the Schedule tab.
- If the runbook is not currently linked to a schedule, then you are offered the option to Link to a New Schedule or Link to an Existing Schedule. If the runbook is currently linked to a schedule, click Link at the bottom of the window to access these options.
- If the runbook has parameters, you are prompted for their values.
You can use the Register-AzureAutomationScheduledRunbook to link a schedule to a classic runbook or Register-AzureRmAutomationScheduledRunbook cmdlet for runbooks in the Azure portal. You can specify values for the runbook’s parameters with the Parameters parameter. See Starting a Runbook in Azure Automation for more information on specifying parameter values.
The following sample commands show how to link a schedule to a runbook using an Azure Resource Manager cmdlet with parameters.
$automationAccountName = "MyAutomationAccount"
$runbookName = "Test-Runbook"
$scheduleName = "Sample-DailySchedule"
$params = @{"FirstName"="Joe";"LastName"="Smith";"RepeatCount"=2;"Show"=$true}
Register-AzureRmAutomationScheduledRunbook –AutomationAccountName $automationAccountName `
–Name $runbookName –ScheduleName $scheduleName –Parameters $params `
-ResourceGroupName "ResourceGroup01"
The following sample commands show how to link a schedule using an Azure Service Management cmdlet with parameters.
$automationAccountName = "MyAutomationAccount"
$runbookName = "Test-Runbook"
$scheduleName = "Sample-DailySchedule"
$params = @{"FirstName"="Joe";"LastName"="Smith";"RepeatCount"=2;"Show"=$true}
Register-AzureAutomationScheduledRunbook –AutomationAccountName $automationAccountName `
–Name $runbookName –ScheduleName $scheduleName –Parameters $params
When you disable a schedule, any runbooks linked to it no longer runs on that schedule. You can manually disable a schedule or set an expiration time for schedules with a frequency when you create them. When the expiration time is reached, the schedule is disabled.
- In the Azure portal, from your Automation account, select Schedules under the section Shared Resources on the left.
- Click the name of a schedule to open the details pane.
- Change Enabled to No.
You can disable a schedule in the Azure classic portal from the Schedule Details page for the schedule.
- In the Azure classic portal, select Automation and then click the name of an Automation account.
- Select the Assets tab.
- Click the name of a schedule to open its detail page.
- Change Enabled to No.
You can use the Set-AzureAutomationSchedule cmdlet to change the properties of an existing schedule for a classic runbook or Set-AzureRmAutomationSchedule cmdlet for runbooks in the Azure portal. To disable the schedule, specify false for the IsEnabled parameter.
The following sample commands show how to disable a schedule for a runbook using an Azure Resource Manager cmdlet.
$automationAccountName = "MyAutomationAccount"
$scheduleName = "Sample-MonthlyDaysOfMonthSchedule"
Set-AzureRmAutomationSchedule –AutomationAccountName $automationAccountName `
–Name $scheduleName –IsEnabled $false -ResourceGroupName "ResourceGroup01"
The following sample commands show how to disable a schedule using the Azure Service Management cmdlet.
$automationAccountName = "MyAutomationAccount"
$scheduleName = "Sample-DailySchedule"
Set-AzureAutomationSchedule –AutomationAccountName $automationAccountName `
–Name $scheduleName –IsEnabled $false
- To get started with runbooks in Azure Automation, see Starting a Runbook in Azure Automation