Bicep resource definition
The schedules resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
Usage Examples
Bicep Samples
A basic example of deploying automated shutdown schedules for Azure Resource Manager VMs outside of Dev Test Labs.
param resourceName string = 'acctest0001'
param location string = 'westeurope'
@secure()
@description('The administrator password for the virtual machine')
param adminPassword string
resource schedule 'Microsoft.DevTestLab/schedules@2018-09-15' = {
name: resourceName
location: location
properties: {
dailyRecurrence: {
time: '0100'
}
notificationSettings: {
emailRecipient: ''
status: 'Disabled'
timeInMinutes: 30
webhookUrl: ''
}
status: 'Enabled'
targetResourceId: virtualMachine.id
taskType: 'ComputeVmShutdownTask'
timeZoneId: 'Pacific Standard Time'
}
tags: {
environment: 'Production'
}
}
resource virtualMachine 'Microsoft.Compute/virtualMachines@2023-03-01' = {
name: resourceName
location: location
properties: {
additionalCapabilities: {}
applicationProfile: {
galleryApplications: []
}
diagnosticsProfile: {
bootDiagnostics: {
enabled: false
storageUri: ''
}
}
extensionsTimeBudget: 'PT1H30M'
hardwareProfile: {
vmSize: 'Standard_B2s'
}
networkProfile: {
networkInterfaces: [
{
id: networkInterface.id
properties: {
primary: true
}
}
]
}
osProfile: {
adminPassword: adminPassword
adminUsername: 'testadmin'
allowExtensionOperations: true
computerName: resourceName
linuxConfiguration: {
disablePasswordAuthentication: false
patchSettings: {
assessmentMode: 'ImageDefault'
patchMode: 'ImageDefault'
}
provisionVMAgent: true
ssh: {
publicKeys: []
}
}
secrets: []
}
priority: 'Regular'
storageProfile: {
dataDisks: []
imageReference: {
offer: 'UbuntuServer'
publisher: 'Canonical'
sku: '18.04-LTS'
version: 'latest'
}
osDisk: {
caching: 'ReadWrite'
createOption: 'FromImage'
managedDisk: {
storageAccountType: 'Standard_LRS'
}
name: 'myosdisk-230630033106863551'
osType: 'Linux'
writeAcceleratorEnabled: false
}
}
}
}
resource virtualNetwork 'Microsoft.Network/virtualNetworks@2022-07-01' = {
name: resourceName
location: location
properties: {
addressSpace: {
addressPrefixes: [
'10.0.0.0/16'
]
}
dhcpOptions: {
dnsServers: []
}
subnets: []
}
}
resource subnet 'Microsoft.Network/virtualNetworks/subnets@2022-07-01' = {
name: resourceName
parent: virtualNetwork
properties: {
addressPrefix: '10.0.2.0/24'
delegations: []
privateEndpointNetworkPolicies: 'Enabled'
privateLinkServiceNetworkPolicies: 'Enabled'
serviceEndpointPolicies: []
serviceEndpoints: []
}
}
resource networkInterface 'Microsoft.Network/networkInterfaces@2022-07-01' = {
name: resourceName
location: location
properties: {
enableAcceleratedNetworking: false
enableIPForwarding: false
ipConfigurations: [
{
name: 'testconfiguration1'
properties: {
primary: true
privateIPAddressVersion: 'IPv4'
privateIPAllocationMethod: 'Dynamic'
subnet: {
id: subnet.id
}
}
}
]
}
}
To create a Microsoft.DevTestLab/schedules resource, add the following Bicep to your template.
resource symbolicname 'Microsoft.DevTestLab/schedules@2018-09-15' = {
location: 'string'
name: 'string'
properties: {
dailyRecurrence: {
time: 'string'
}
hourlyRecurrence: {
minute: int
}
notificationSettings: {
emailRecipient: 'string'
notificationLocale: 'string'
status: 'string'
timeInMinutes: int
webhookUrl: 'string'
}
status: 'string'
targetResourceId: 'string'
taskType: 'string'
timeZoneId: 'string'
weeklyRecurrence: {
time: 'string'
weekdays: [
'string'
]
}
}
tags: {
{customized property}: 'string'
}
}
Property Values
Microsoft.DevTestLab/schedules
| Name |
Description |
Value |
| location |
The geo-location where the resource lives |
string |
| name |
The resource name |
string (required) |
| properties |
The properties of the resource. |
ScheduleProperties (required) |
| tags |
Resource tags |
Dictionary of tag names and values. See Tags in templates |
DayDetails
| Name |
Description |
Value |
| time |
The time of day the schedule will occur. |
string |
HourDetails
| Name |
Description |
Value |
| minute |
Minutes of the hour the schedule will run. |
int |
NotificationSettings
| Name |
Description |
Value |
| emailRecipient |
The email recipient to send notifications to (can be a list of semi-colon separated email addresses). |
string |
| notificationLocale |
The locale to use when sending a notification (fallback for unsupported languages is EN). |
string |
| status |
If notifications are enabled for this schedule (i.e. Enabled, Disabled). |
'Disabled' 'Enabled' |
| timeInMinutes |
Time in minutes before event at which notification will be sent. |
int |
| webhookUrl |
The webhook URL to which the notification will be sent. |
string |
ScheduleProperties
| Name |
Description |
Value |
| dailyRecurrence |
If the schedule will occur once each day of the week, specify the daily recurrence. |
DayDetails |
| hourlyRecurrence |
If the schedule will occur multiple times a day, specify the hourly recurrence. |
HourDetails |
| notificationSettings |
Notification settings. |
NotificationSettings |
| status |
The status of the schedule (i.e. Enabled, Disabled) |
'Disabled' 'Enabled' |
| targetResourceId |
The resource ID to which the schedule belongs |
string |
| taskType |
The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). |
string |
| timeZoneId |
The time zone ID (e.g. China Standard Time, Greenland Standard Time, Pacific Standard time, etc.). The possible values for this property can be found in IReadOnlyCollection<string> TimeZoneConverter.TZConvert.KnownWindowsTimeZoneIds (https://github.com/mattjohnsonpint/TimeZoneConverter/blob/main/README.md) |
string |
| weeklyRecurrence |
If the schedule will occur only some days of the week, specify the weekly recurrence. |
WeekDetails |
WeekDetails
| Name |
Description |
Value |
| time |
The time of the day the schedule will occur. |
string |
| weekdays |
The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). |
string[] |
ARM template resource definition
The schedules resource type can be deployed with operations that target:
Usage Examples
To create a Microsoft.DevTestLab/schedules resource, add the following JSON to your template.
{
"type": "Microsoft.DevTestLab/schedules",
"apiVersion": "2018-09-15",
"name": "string",
"location": "string",
"properties": {
"dailyRecurrence": {
"time": "string"
},
"hourlyRecurrence": {
"minute": "int"
},
"notificationSettings": {
"emailRecipient": "string",
"notificationLocale": "string",
"status": "string",
"timeInMinutes": "int",
"webhookUrl": "string"
},
"status": "string",
"targetResourceId": "string",
"taskType": "string",
"timeZoneId": "string",
"weeklyRecurrence": {
"time": "string",
"weekdays": [ "string" ]
}
},
"tags": {
"{customized property}": "string"
}
}
Property Values
Microsoft.DevTestLab/schedules
| Name |
Description |
Value |
| apiVersion |
The api version |
'2018-09-15' |
| location |
The geo-location where the resource lives |
string |
| name |
The resource name |
string (required) |
| properties |
The properties of the resource. |
ScheduleProperties (required) |
| tags |
Resource tags |
Dictionary of tag names and values. See Tags in templates |
| type |
The resource type |
'Microsoft.DevTestLab/schedules' |
DayDetails
| Name |
Description |
Value |
| time |
The time of day the schedule will occur. |
string |
HourDetails
| Name |
Description |
Value |
| minute |
Minutes of the hour the schedule will run. |
int |
NotificationSettings
| Name |
Description |
Value |
| emailRecipient |
The email recipient to send notifications to (can be a list of semi-colon separated email addresses). |
string |
| notificationLocale |
The locale to use when sending a notification (fallback for unsupported languages is EN). |
string |
| status |
If notifications are enabled for this schedule (i.e. Enabled, Disabled). |
'Disabled' 'Enabled' |
| timeInMinutes |
Time in minutes before event at which notification will be sent. |
int |
| webhookUrl |
The webhook URL to which the notification will be sent. |
string |
ScheduleProperties
| Name |
Description |
Value |
| dailyRecurrence |
If the schedule will occur once each day of the week, specify the daily recurrence. |
DayDetails |
| hourlyRecurrence |
If the schedule will occur multiple times a day, specify the hourly recurrence. |
HourDetails |
| notificationSettings |
Notification settings. |
NotificationSettings |
| status |
The status of the schedule (i.e. Enabled, Disabled) |
'Disabled' 'Enabled' |
| targetResourceId |
The resource ID to which the schedule belongs |
string |
| taskType |
The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). |
string |
| timeZoneId |
The time zone ID (e.g. China Standard Time, Greenland Standard Time, Pacific Standard time, etc.). The possible values for this property can be found in IReadOnlyCollection<string> TimeZoneConverter.TZConvert.KnownWindowsTimeZoneIds (https://github.com/mattjohnsonpint/TimeZoneConverter/blob/main/README.md) |
string |
| weeklyRecurrence |
If the schedule will occur only some days of the week, specify the weekly recurrence. |
WeekDetails |
WeekDetails
| Name |
Description |
Value |
| time |
The time of the day the schedule will occur. |
string |
| weekdays |
The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). |
string[] |
The schedules resource type can be deployed with operations that target:
- Resource groups
For a list of changed properties in each API version, see change log.
Usage Examples
A basic example of deploying automated shutdown schedules for Azure Resource Manager VMs outside of Dev Test Labs.
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
}
}
provider "azapi" {
skip_provider_registration = false
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "westeurope"
}
variable "admin_password" {
type = string
description = "The administrator password for the virtual machine"
sensitive = true
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}
resource "azapi_resource" "virtualNetwork" {
type = "Microsoft.Network/virtualNetworks@2022-07-01"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
properties = {
addressSpace = {
addressPrefixes = [
"10.0.0.0/16",
]
}
dhcpOptions = {
dnsServers = [
]
}
subnets = [
]
}
}
schema_validation_enabled = false
response_export_values = ["*"]
lifecycle {
ignore_changes = [body.properties.subnets]
}
}
resource "azapi_resource" "subnet" {
type = "Microsoft.Network/virtualNetworks/subnets@2022-07-01"
parent_id = azapi_resource.virtualNetwork.id
name = var.resource_name
body = {
properties = {
addressPrefix = "10.0.2.0/24"
delegations = [
]
privateEndpointNetworkPolicies = "Enabled"
privateLinkServiceNetworkPolicies = "Enabled"
serviceEndpointPolicies = [
]
serviceEndpoints = [
]
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "networkInterface" {
type = "Microsoft.Network/networkInterfaces@2022-07-01"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
properties = {
enableAcceleratedNetworking = false
enableIPForwarding = false
ipConfigurations = [
{
name = "testconfiguration1"
properties = {
primary = true
privateIPAddressVersion = "IPv4"
privateIPAllocationMethod = "Dynamic"
subnet = {
id = azapi_resource.subnet.id
}
}
},
]
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "virtualMachine" {
type = "Microsoft.Compute/virtualMachines@2023-03-01"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
properties = {
additionalCapabilities = {
}
applicationProfile = {
galleryApplications = [
]
}
diagnosticsProfile = {
bootDiagnostics = {
enabled = false
storageUri = ""
}
}
extensionsTimeBudget = "PT1H30M"
hardwareProfile = {
vmSize = "Standard_B2s"
}
networkProfile = {
networkInterfaces = [
{
id = azapi_resource.networkInterface.id
properties = {
primary = true
}
},
]
}
osProfile = {
adminPassword = var.admin_password
adminUsername = "testadmin"
allowExtensionOperations = true
computerName = var.resource_name
linuxConfiguration = {
disablePasswordAuthentication = false
patchSettings = {
assessmentMode = "ImageDefault"
patchMode = "ImageDefault"
}
provisionVMAgent = true
ssh = {
publicKeys = [
]
}
}
secrets = [
]
}
priority = "Regular"
storageProfile = {
dataDisks = [
]
imageReference = {
offer = "UbuntuServer"
publisher = "Canonical"
sku = "18.04-LTS"
version = "latest"
}
osDisk = {
caching = "ReadWrite"
createOption = "FromImage"
managedDisk = {
storageAccountType = "Standard_LRS"
}
name = "myosdisk-230630033106863551"
osType = "Linux"
writeAcceleratorEnabled = false
}
}
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "schedule" {
type = "Microsoft.DevTestLab/schedules@2018-09-15"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
properties = {
dailyRecurrence = {
time = "0100"
}
notificationSettings = {
emailRecipient = ""
status = "Disabled"
timeInMinutes = 30
webhookUrl = ""
}
status = "Enabled"
targetResourceId = azapi_resource.virtualMachine.id
taskType = "ComputeVmShutdownTask"
timeZoneId = "Pacific Standard Time"
}
tags = {
environment = "Production"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
To create a Microsoft.DevTestLab/schedules resource, add the following Terraform to your template.
resource "azapi_resource" "symbolicname" {
type = "Microsoft.DevTestLab/schedules@2018-09-15"
name = "string"
parent_id = "string"
location = "string"
tags = {
{customized property} = "string"
}
body = {
properties = {
dailyRecurrence = {
time = "string"
}
hourlyRecurrence = {
minute = int
}
notificationSettings = {
emailRecipient = "string"
notificationLocale = "string"
status = "string"
timeInMinutes = int
webhookUrl = "string"
}
status = "string"
targetResourceId = "string"
taskType = "string"
timeZoneId = "string"
weeklyRecurrence = {
time = "string"
weekdays = [
"string"
]
}
}
}
}
Property Values
Microsoft.DevTestLab/schedules
| Name |
Description |
Value |
| location |
The geo-location where the resource lives |
string |
| name |
The resource name |
string (required) |
| properties |
The properties of the resource. |
ScheduleProperties (required) |
| tags |
Resource tags |
Dictionary of tag names and values. |
| type |
The resource type |
"Microsoft.DevTestLab/schedules@2018-09-15" |
DayDetails
| Name |
Description |
Value |
| time |
The time of day the schedule will occur. |
string |
HourDetails
| Name |
Description |
Value |
| minute |
Minutes of the hour the schedule will run. |
int |
NotificationSettings
| Name |
Description |
Value |
| emailRecipient |
The email recipient to send notifications to (can be a list of semi-colon separated email addresses). |
string |
| notificationLocale |
The locale to use when sending a notification (fallback for unsupported languages is EN). |
string |
| status |
If notifications are enabled for this schedule (i.e. Enabled, Disabled). |
'Disabled' 'Enabled' |
| timeInMinutes |
Time in minutes before event at which notification will be sent. |
int |
| webhookUrl |
The webhook URL to which the notification will be sent. |
string |
ScheduleProperties
| Name |
Description |
Value |
| dailyRecurrence |
If the schedule will occur once each day of the week, specify the daily recurrence. |
DayDetails |
| hourlyRecurrence |
If the schedule will occur multiple times a day, specify the hourly recurrence. |
HourDetails |
| notificationSettings |
Notification settings. |
NotificationSettings |
| status |
The status of the schedule (i.e. Enabled, Disabled) |
'Disabled' 'Enabled' |
| targetResourceId |
The resource ID to which the schedule belongs |
string |
| taskType |
The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). |
string |
| timeZoneId |
The time zone ID (e.g. China Standard Time, Greenland Standard Time, Pacific Standard time, etc.). The possible values for this property can be found in IReadOnlyCollection<string> TimeZoneConverter.TZConvert.KnownWindowsTimeZoneIds (https://github.com/mattjohnsonpint/TimeZoneConverter/blob/main/README.md) |
string |
| weeklyRecurrence |
If the schedule will occur only some days of the week, specify the weekly recurrence. |
WeekDetails |
WeekDetails
| Name |
Description |
Value |
| time |
The time of the day the schedule will occur. |
string |
| weekdays |
The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). |
string[] |