Bicep resource definition
The labs/virtualmachines resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
To create a Microsoft.DevTestLab/labs/virtualmachines resource, add the following Bicep to your template.
resource symbolicname 'Microsoft.DevTestLab/labs/virtualmachines@2018-09-15' = {
parent: resourceSymbolicName
location: 'string'
name: 'string'
properties: {
allowClaim: bool
artifacts: [
{
artifactId: 'string'
artifactTitle: 'string'
deploymentStatusMessage: 'string'
installTime: 'string'
parameters: [
{
name: 'string'
value: 'string'
}
]
status: 'string'
vmExtensionStatusMessage: 'string'
}
]
createdDate: 'string'
customImageId: 'string'
dataDiskParameters: [
{
attachNewDataDiskOptions: {
diskName: 'string'
diskSizeGiB: int
diskType: 'string'
}
existingLabDiskId: 'string'
hostCaching: 'string'
}
]
disallowPublicIpAddress: bool
environmentId: 'string'
expirationDate: 'string'
galleryImageReference: {
offer: 'string'
osType: 'string'
publisher: 'string'
sku: 'string'
version: 'string'
}
isAuthenticationWithSshKey: bool
labSubnetName: 'string'
labVirtualNetworkId: 'string'
networkInterface: {
dnsName: 'string'
privateIpAddress: 'string'
publicIpAddress: 'string'
publicIpAddressId: 'string'
rdpAuthority: 'string'
sharedPublicIpAddressConfiguration: {
inboundNatRules: [
{
backendPort: int
frontendPort: int
transportProtocol: 'string'
}
]
}
sshAuthority: 'string'
subnetId: 'string'
virtualNetworkId: 'string'
}
notes: 'string'
ownerObjectId: 'string'
ownerUserPrincipalName: 'string'
password: 'string'
planId: 'string'
scheduleParameters: [
{
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'
}
}
]
size: 'string'
sshKey: 'string'
storageType: 'string'
userName: 'string'
}
tags: {
{customized property}: 'string'
}
}
Property Values
Microsoft.DevTestLab/labs/virtualmachines
| Name |
Description |
Value |
| location |
The location of the resource. |
string |
| name |
The resource name |
string (required) |
| parent |
In Bicep, you can specify the parent resource for a child resource. You only need to add this property when the child resource is declared outside of the parent resource.
For more information, see Child resource outside parent resource. |
Symbolic name for resource of type: labs |
| properties |
The properties of the resource. |
LabVirtualMachineProperties (required) |
| tags |
Resource tags |
Dictionary of tag names and values. See Tags in templates |
ArtifactInstallProperties
| Name |
Description |
Value |
| artifactId |
The artifact's identifier. |
string |
| artifactTitle |
The artifact's title. |
string |
| deploymentStatusMessage |
The status message from the deployment. |
string |
| installTime |
The time that the artifact starts to install on the virtual machine. |
string |
| parameters |
The parameters of the artifact. |
ArtifactParameterProperties[] |
| status |
The status of the artifact. |
string |
| vmExtensionStatusMessage |
The status message from the virtual machine extension. |
string |
ArtifactParameterProperties
| Name |
Description |
Value |
| name |
The name of the artifact parameter. |
string |
| value |
The value of the artifact parameter. |
string |
AttachNewDataDiskOptions
| Name |
Description |
Value |
| diskName |
The name of the disk to be attached. |
string |
| diskSizeGiB |
Size of the disk to be attached in Gibibytes. |
int |
| diskType |
The storage type for the disk (i.e. Standard, Premium). |
'Premium' 'Standard' 'StandardSSD' |
DataDiskProperties
| Name |
Description |
Value |
| attachNewDataDiskOptions |
Specifies options to attach a new disk to the virtual machine. |
AttachNewDataDiskOptions |
| existingLabDiskId |
Specifies the existing lab disk id to attach to virtual machine. |
string |
| hostCaching |
Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). |
'None' 'ReadOnly' 'ReadWrite' |
DayDetails
| Name |
Description |
Value |
| time |
The time of day the schedule will occur. |
string |
GalleryImageReference
| Name |
Description |
Value |
| offer |
The offer of the gallery image. |
string |
| osType |
The OS type of the gallery image. |
string |
| publisher |
The publisher of the gallery image. |
string |
| sku |
The SKU of the gallery image. |
string |
| version |
The version of the gallery image. |
string |
HourDetails
| Name |
Description |
Value |
| minute |
Minutes of the hour the schedule will run. |
int |
InboundNatRule
| Name |
Description |
Value |
| backendPort |
The port to which the external traffic will be redirected. |
int |
| frontendPort |
The external endpoint port of the inbound connection. Possible values range between 1 and 65535, inclusive. If unspecified, a value will be allocated automatically. |
int |
| transportProtocol |
The transport protocol for the endpoint. |
'Tcp' 'Udp' |
LabVirtualMachineProperties
| Name |
Description |
Value |
| allowClaim |
Indicates whether another user can take ownership of the virtual machine |
bool |
| artifacts |
The artifacts to be installed on the virtual machine. |
ArtifactInstallProperties[] |
| createdDate |
The creation date of the virtual machine. |
string |
| customImageId |
The custom image identifier of the virtual machine. |
string |
| dataDiskParameters |
New or existing data disks to attach to the virtual machine after creation |
DataDiskProperties[] |
| disallowPublicIpAddress |
Indicates whether the virtual machine is to be created without a public IP address. |
bool |
| environmentId |
The resource ID of the environment that contains this virtual machine, if any. |
string |
| expirationDate |
The expiration date for VM. |
string |
| galleryImageReference |
The Microsoft Azure Marketplace image reference of the virtual machine. |
GalleryImageReference |
| isAuthenticationWithSshKey |
Indicates whether this virtual machine uses an SSH key for authentication. |
bool |
| labSubnetName |
The lab subnet name of the virtual machine. |
string |
| labVirtualNetworkId |
The lab virtual network identifier of the virtual machine. |
string |
| networkInterface |
The network interface properties. |
NetworkInterfaceProperties |
| notes |
The notes of the virtual machine. |
string |
| ownerObjectId |
The object identifier of the owner of the virtual machine. |
string |
| ownerUserPrincipalName |
The user principal name of the virtual machine owner. |
string |
| password |
The password of the virtual machine administrator. |
string |
| planId |
The id of the plan associated with the virtual machine image |
string |
| scheduleParameters |
Virtual Machine schedules to be created |
ScheduleCreationParameter[] |
| size |
The size of the virtual machine. |
string |
| sshKey |
The SSH key of the virtual machine administrator. |
string |
| storageType |
Storage type to use for virtual machine (i.e. Standard, Premium). |
string |
| userName |
The user name of the virtual machine. |
string |
NetworkInterfaceProperties
| Name |
Description |
Value |
| dnsName |
The DNS name. |
string |
| privateIpAddress |
The private IP address. |
string |
| publicIpAddress |
The public IP address. |
string |
| publicIpAddressId |
The resource ID of the public IP address. |
string |
| rdpAuthority |
The RdpAuthority property is a server DNS host name or IP address followed by the service port number for RDP (Remote Desktop Protocol). |
string |
| sharedPublicIpAddressConfiguration |
The configuration for sharing a public IP address across multiple virtual machines. |
SharedPublicIpAddressConfiguration |
| sshAuthority |
The SshAuthority property is a server DNS host name or IP address followed by the service port number for SSH. |
string |
| subnetId |
The resource ID of the sub net. |
string |
| virtualNetworkId |
The resource ID of the virtual network. |
string |
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 |
ScheduleCreationParameter
ScheduleCreationParameterProperties
| 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 |
SharedPublicIpAddressConfiguration
| Name |
Description |
Value |
| inboundNatRules |
The incoming NAT rules |
InboundNatRule[] |
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[] |
Usage Examples
Azure Quickstart Samples
The following Azure Quickstart templates contain Bicep samples for deploying this resource type.
ARM template resource definition
The labs/virtualmachines resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
To create a Microsoft.DevTestLab/labs/virtualmachines resource, add the following JSON to your template.
{
"type": "Microsoft.DevTestLab/labs/virtualmachines",
"apiVersion": "2018-09-15",
"name": "string",
"location": "string",
"properties": {
"allowClaim": "bool",
"artifacts": [
{
"artifactId": "string",
"artifactTitle": "string",
"deploymentStatusMessage": "string",
"installTime": "string",
"parameters": [
{
"name": "string",
"value": "string"
}
],
"status": "string",
"vmExtensionStatusMessage": "string"
}
],
"createdDate": "string",
"customImageId": "string",
"dataDiskParameters": [
{
"attachNewDataDiskOptions": {
"diskName": "string",
"diskSizeGiB": "int",
"diskType": "string"
},
"existingLabDiskId": "string",
"hostCaching": "string"
}
],
"disallowPublicIpAddress": "bool",
"environmentId": "string",
"expirationDate": "string",
"galleryImageReference": {
"offer": "string",
"osType": "string",
"publisher": "string",
"sku": "string",
"version": "string"
},
"isAuthenticationWithSshKey": "bool",
"labSubnetName": "string",
"labVirtualNetworkId": "string",
"networkInterface": {
"dnsName": "string",
"privateIpAddress": "string",
"publicIpAddress": "string",
"publicIpAddressId": "string",
"rdpAuthority": "string",
"sharedPublicIpAddressConfiguration": {
"inboundNatRules": [
{
"backendPort": "int",
"frontendPort": "int",
"transportProtocol": "string"
}
]
},
"sshAuthority": "string",
"subnetId": "string",
"virtualNetworkId": "string"
},
"notes": "string",
"ownerObjectId": "string",
"ownerUserPrincipalName": "string",
"password": "string",
"planId": "string",
"scheduleParameters": [
{
"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"
}
}
],
"size": "string",
"sshKey": "string",
"storageType": "string",
"userName": "string"
},
"tags": {
"{customized property}": "string"
}
}
Property Values
Microsoft.DevTestLab/labs/virtualmachines
| Name |
Description |
Value |
| apiVersion |
The api version |
'2018-09-15' |
| location |
The location of the resource. |
string |
| name |
The resource name |
string (required) |
| properties |
The properties of the resource. |
LabVirtualMachineProperties (required) |
| tags |
Resource tags |
Dictionary of tag names and values. See Tags in templates |
| type |
The resource type |
'Microsoft.DevTestLab/labs/virtualmachines' |
ArtifactInstallProperties
| Name |
Description |
Value |
| artifactId |
The artifact's identifier. |
string |
| artifactTitle |
The artifact's title. |
string |
| deploymentStatusMessage |
The status message from the deployment. |
string |
| installTime |
The time that the artifact starts to install on the virtual machine. |
string |
| parameters |
The parameters of the artifact. |
ArtifactParameterProperties[] |
| status |
The status of the artifact. |
string |
| vmExtensionStatusMessage |
The status message from the virtual machine extension. |
string |
ArtifactParameterProperties
| Name |
Description |
Value |
| name |
The name of the artifact parameter. |
string |
| value |
The value of the artifact parameter. |
string |
AttachNewDataDiskOptions
| Name |
Description |
Value |
| diskName |
The name of the disk to be attached. |
string |
| diskSizeGiB |
Size of the disk to be attached in Gibibytes. |
int |
| diskType |
The storage type for the disk (i.e. Standard, Premium). |
'Premium' 'Standard' 'StandardSSD' |
DataDiskProperties
| Name |
Description |
Value |
| attachNewDataDiskOptions |
Specifies options to attach a new disk to the virtual machine. |
AttachNewDataDiskOptions |
| existingLabDiskId |
Specifies the existing lab disk id to attach to virtual machine. |
string |
| hostCaching |
Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). |
'None' 'ReadOnly' 'ReadWrite' |
DayDetails
| Name |
Description |
Value |
| time |
The time of day the schedule will occur. |
string |
GalleryImageReference
| Name |
Description |
Value |
| offer |
The offer of the gallery image. |
string |
| osType |
The OS type of the gallery image. |
string |
| publisher |
The publisher of the gallery image. |
string |
| sku |
The SKU of the gallery image. |
string |
| version |
The version of the gallery image. |
string |
HourDetails
| Name |
Description |
Value |
| minute |
Minutes of the hour the schedule will run. |
int |
InboundNatRule
| Name |
Description |
Value |
| backendPort |
The port to which the external traffic will be redirected. |
int |
| frontendPort |
The external endpoint port of the inbound connection. Possible values range between 1 and 65535, inclusive. If unspecified, a value will be allocated automatically. |
int |
| transportProtocol |
The transport protocol for the endpoint. |
'Tcp' 'Udp' |
LabVirtualMachineProperties
| Name |
Description |
Value |
| allowClaim |
Indicates whether another user can take ownership of the virtual machine |
bool |
| artifacts |
The artifacts to be installed on the virtual machine. |
ArtifactInstallProperties[] |
| createdDate |
The creation date of the virtual machine. |
string |
| customImageId |
The custom image identifier of the virtual machine. |
string |
| dataDiskParameters |
New or existing data disks to attach to the virtual machine after creation |
DataDiskProperties[] |
| disallowPublicIpAddress |
Indicates whether the virtual machine is to be created without a public IP address. |
bool |
| environmentId |
The resource ID of the environment that contains this virtual machine, if any. |
string |
| expirationDate |
The expiration date for VM. |
string |
| galleryImageReference |
The Microsoft Azure Marketplace image reference of the virtual machine. |
GalleryImageReference |
| isAuthenticationWithSshKey |
Indicates whether this virtual machine uses an SSH key for authentication. |
bool |
| labSubnetName |
The lab subnet name of the virtual machine. |
string |
| labVirtualNetworkId |
The lab virtual network identifier of the virtual machine. |
string |
| networkInterface |
The network interface properties. |
NetworkInterfaceProperties |
| notes |
The notes of the virtual machine. |
string |
| ownerObjectId |
The object identifier of the owner of the virtual machine. |
string |
| ownerUserPrincipalName |
The user principal name of the virtual machine owner. |
string |
| password |
The password of the virtual machine administrator. |
string |
| planId |
The id of the plan associated with the virtual machine image |
string |
| scheduleParameters |
Virtual Machine schedules to be created |
ScheduleCreationParameter[] |
| size |
The size of the virtual machine. |
string |
| sshKey |
The SSH key of the virtual machine administrator. |
string |
| storageType |
Storage type to use for virtual machine (i.e. Standard, Premium). |
string |
| userName |
The user name of the virtual machine. |
string |
NetworkInterfaceProperties
| Name |
Description |
Value |
| dnsName |
The DNS name. |
string |
| privateIpAddress |
The private IP address. |
string |
| publicIpAddress |
The public IP address. |
string |
| publicIpAddressId |
The resource ID of the public IP address. |
string |
| rdpAuthority |
The RdpAuthority property is a server DNS host name or IP address followed by the service port number for RDP (Remote Desktop Protocol). |
string |
| sharedPublicIpAddressConfiguration |
The configuration for sharing a public IP address across multiple virtual machines. |
SharedPublicIpAddressConfiguration |
| sshAuthority |
The SshAuthority property is a server DNS host name or IP address followed by the service port number for SSH. |
string |
| subnetId |
The resource ID of the sub net. |
string |
| virtualNetworkId |
The resource ID of the virtual network. |
string |
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 |
ScheduleCreationParameter
ScheduleCreationParameterProperties
| 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 |
SharedPublicIpAddressConfiguration
| Name |
Description |
Value |
| inboundNatRules |
The incoming NAT rules |
InboundNatRule[] |
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[] |
Usage Examples
Azure Quickstart Templates
The following Azure Quickstart templates deploy this resource type.
The labs/virtualmachines resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
To create a Microsoft.DevTestLab/labs/virtualmachines resource, add the following Terraform to your template.
resource "azapi_resource" "symbolicname" {
type = "Microsoft.DevTestLab/labs/virtualmachines@2018-09-15"
name = "string"
parent_id = "string"
location = "string"
tags = {
{customized property} = "string"
}
body = {
properties = {
allowClaim = bool
artifacts = [
{
artifactId = "string"
artifactTitle = "string"
deploymentStatusMessage = "string"
installTime = "string"
parameters = [
{
name = "string"
value = "string"
}
]
status = "string"
vmExtensionStatusMessage = "string"
}
]
createdDate = "string"
customImageId = "string"
dataDiskParameters = [
{
attachNewDataDiskOptions = {
diskName = "string"
diskSizeGiB = int
diskType = "string"
}
existingLabDiskId = "string"
hostCaching = "string"
}
]
disallowPublicIpAddress = bool
environmentId = "string"
expirationDate = "string"
galleryImageReference = {
offer = "string"
osType = "string"
publisher = "string"
sku = "string"
version = "string"
}
isAuthenticationWithSshKey = bool
labSubnetName = "string"
labVirtualNetworkId = "string"
networkInterface = {
dnsName = "string"
privateIpAddress = "string"
publicIpAddress = "string"
publicIpAddressId = "string"
rdpAuthority = "string"
sharedPublicIpAddressConfiguration = {
inboundNatRules = [
{
backendPort = int
frontendPort = int
transportProtocol = "string"
}
]
}
sshAuthority = "string"
subnetId = "string"
virtualNetworkId = "string"
}
notes = "string"
ownerObjectId = "string"
ownerUserPrincipalName = "string"
password = "string"
planId = "string"
scheduleParameters = [
{
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"
}
}
]
size = "string"
sshKey = "string"
storageType = "string"
userName = "string"
}
}
}
Property Values
Microsoft.DevTestLab/labs/virtualmachines
| Name |
Description |
Value |
| location |
The location of the resource. |
string |
| name |
The resource name |
string (required) |
| parent_id |
The ID of the resource that is the parent for this resource. |
ID for resource of type: labs |
| properties |
The properties of the resource. |
LabVirtualMachineProperties (required) |
| tags |
Resource tags |
Dictionary of tag names and values. |
| type |
The resource type |
"Microsoft.DevTestLab/labs/virtualmachines@2018-09-15" |
ArtifactInstallProperties
| Name |
Description |
Value |
| artifactId |
The artifact's identifier. |
string |
| artifactTitle |
The artifact's title. |
string |
| deploymentStatusMessage |
The status message from the deployment. |
string |
| installTime |
The time that the artifact starts to install on the virtual machine. |
string |
| parameters |
The parameters of the artifact. |
ArtifactParameterProperties[] |
| status |
The status of the artifact. |
string |
| vmExtensionStatusMessage |
The status message from the virtual machine extension. |
string |
ArtifactParameterProperties
| Name |
Description |
Value |
| name |
The name of the artifact parameter. |
string |
| value |
The value of the artifact parameter. |
string |
AttachNewDataDiskOptions
| Name |
Description |
Value |
| diskName |
The name of the disk to be attached. |
string |
| diskSizeGiB |
Size of the disk to be attached in Gibibytes. |
int |
| diskType |
The storage type for the disk (i.e. Standard, Premium). |
'Premium' 'Standard' 'StandardSSD' |
DataDiskProperties
| Name |
Description |
Value |
| attachNewDataDiskOptions |
Specifies options to attach a new disk to the virtual machine. |
AttachNewDataDiskOptions |
| existingLabDiskId |
Specifies the existing lab disk id to attach to virtual machine. |
string |
| hostCaching |
Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). |
'None' 'ReadOnly' 'ReadWrite' |
DayDetails
| Name |
Description |
Value |
| time |
The time of day the schedule will occur. |
string |
GalleryImageReference
| Name |
Description |
Value |
| offer |
The offer of the gallery image. |
string |
| osType |
The OS type of the gallery image. |
string |
| publisher |
The publisher of the gallery image. |
string |
| sku |
The SKU of the gallery image. |
string |
| version |
The version of the gallery image. |
string |
HourDetails
| Name |
Description |
Value |
| minute |
Minutes of the hour the schedule will run. |
int |
InboundNatRule
| Name |
Description |
Value |
| backendPort |
The port to which the external traffic will be redirected. |
int |
| frontendPort |
The external endpoint port of the inbound connection. Possible values range between 1 and 65535, inclusive. If unspecified, a value will be allocated automatically. |
int |
| transportProtocol |
The transport protocol for the endpoint. |
'Tcp' 'Udp' |
LabVirtualMachineProperties
| Name |
Description |
Value |
| allowClaim |
Indicates whether another user can take ownership of the virtual machine |
bool |
| artifacts |
The artifacts to be installed on the virtual machine. |
ArtifactInstallProperties[] |
| createdDate |
The creation date of the virtual machine. |
string |
| customImageId |
The custom image identifier of the virtual machine. |
string |
| dataDiskParameters |
New or existing data disks to attach to the virtual machine after creation |
DataDiskProperties[] |
| disallowPublicIpAddress |
Indicates whether the virtual machine is to be created without a public IP address. |
bool |
| environmentId |
The resource ID of the environment that contains this virtual machine, if any. |
string |
| expirationDate |
The expiration date for VM. |
string |
| galleryImageReference |
The Microsoft Azure Marketplace image reference of the virtual machine. |
GalleryImageReference |
| isAuthenticationWithSshKey |
Indicates whether this virtual machine uses an SSH key for authentication. |
bool |
| labSubnetName |
The lab subnet name of the virtual machine. |
string |
| labVirtualNetworkId |
The lab virtual network identifier of the virtual machine. |
string |
| networkInterface |
The network interface properties. |
NetworkInterfaceProperties |
| notes |
The notes of the virtual machine. |
string |
| ownerObjectId |
The object identifier of the owner of the virtual machine. |
string |
| ownerUserPrincipalName |
The user principal name of the virtual machine owner. |
string |
| password |
The password of the virtual machine administrator. |
string |
| planId |
The id of the plan associated with the virtual machine image |
string |
| scheduleParameters |
Virtual Machine schedules to be created |
ScheduleCreationParameter[] |
| size |
The size of the virtual machine. |
string |
| sshKey |
The SSH key of the virtual machine administrator. |
string |
| storageType |
Storage type to use for virtual machine (i.e. Standard, Premium). |
string |
| userName |
The user name of the virtual machine. |
string |
NetworkInterfaceProperties
| Name |
Description |
Value |
| dnsName |
The DNS name. |
string |
| privateIpAddress |
The private IP address. |
string |
| publicIpAddress |
The public IP address. |
string |
| publicIpAddressId |
The resource ID of the public IP address. |
string |
| rdpAuthority |
The RdpAuthority property is a server DNS host name or IP address followed by the service port number for RDP (Remote Desktop Protocol). |
string |
| sharedPublicIpAddressConfiguration |
The configuration for sharing a public IP address across multiple virtual machines. |
SharedPublicIpAddressConfiguration |
| sshAuthority |
The SshAuthority property is a server DNS host name or IP address followed by the service port number for SSH. |
string |
| subnetId |
The resource ID of the sub net. |
string |
| virtualNetworkId |
The resource ID of the virtual network. |
string |
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 |
ScheduleCreationParameter
ScheduleCreationParameterProperties
| 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 |
SharedPublicIpAddressConfiguration
| Name |
Description |
Value |
| inboundNatRules |
The incoming NAT rules |
InboundNatRule[] |
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[] |
Usage Examples
A basic example of deploying Virtual Machine within a Dev Test Lab.
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 "vm_password" {
type = string
description = "The password for the DevTest Lab 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" "lab" {
type = "Microsoft.DevTestLab/labs@2018-09-15"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
properties = {
labStorageType = "Premium"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
data "azapi_resource_id" "virtualNetwork" {
type = "Microsoft.Network/virtualNetworks@2023-04-01"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
}
data "azapi_resource_id" "subnet" {
type = "Microsoft.Network/virtualNetworks/subnets@2023-04-01"
parent_id = data.azapi_resource_id.virtualNetwork.id
name = "${var.resource_name}Subnet"
}
resource "azapi_resource" "virtualNetwork" {
type = "Microsoft.DevTestLab/labs/virtualNetworks@2018-09-15"
parent_id = azapi_resource.lab.id
name = var.resource_name
body = {
properties = {
description = ""
subnetOverrides = [
{
labSubnetName = data.azapi_resource_id.subnet.name
resourceId = data.azapi_resource_id.subnet.id
useInVmCreationPermission = "Allow"
usePublicIpAddressPermission = "Allow"
},
]
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "virtualMachine" {
type = "Microsoft.DevTestLab/labs/virtualMachines@2018-09-15"
parent_id = azapi_resource.lab.id
name = var.resource_name
location = var.location
body = {
properties = {
allowClaim = true
disallowPublicIpAddress = false
galleryImageReference = {
offer = "WindowsServer"
osType = "Windows"
publisher = "MicrosoftWindowsServer"
sku = "2012-Datacenter"
version = "latest"
}
isAuthenticationWithSshKey = false
labSubnetName = data.azapi_resource_id.subnet.name
labVirtualNetworkId = azapi_resource.virtualNetwork.id
networkInterface = {
}
notes = ""
osType = "Windows"
password = var.vm_password
size = "Standard_F2"
storageType = "Standard"
userName = "acct5stU5er"
}
}
ignore_casing = true
schema_validation_enabled = false
response_export_values = ["*"]
}