Azure Dev Test Windows Virtual Machine
This page shows how to write Terraform and Azure Resource Manager for Dev Test Windows Virtual Machine and write them securely.
azurerm_dev_test_windows_virtual_machine (Terraform)
The Windows Virtual Machine in Dev Test can be configured in Terraform with the resource name azurerm_dev_test_windows_virtual_machine
. The following sections describe 4 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_dev_test_windows_virtual_machine" "example" {
name = "example-vm01"
resource_group_name = “my-resources”
location = azurerm_resource_group.example.location
size = "Standard_DS2"
username = "exampleuser99"
resource "azurerm_dev_test_windows_virtual_machine" "this" {
allow_claim = var.allow_claim
disallow_public_ip_address = var.disallow_public_ip_address
lab_name = var.lab_name
lab_subnet_name = var.lab_subnet_name
lab_virtual_network_id = var.lab_virtual_network_id
resource "azurerm_dev_test_windows_virtual_machine" "this" {
allow_claim = var.allow_claim
disallow_public_ip_address = var.disallow_public_ip_address
lab_name = var.lab_name
lab_subnet_name = var.lab_subnet_name
lab_virtual_network_id = var.lab_virtual_network_id
resource "azurerm_dev_test_windows_virtual_machine" "main" {
for_each = var.windows_virtual_machine != null ? { for k, v in var.windows_virtual_machine : k => v if v != null } : {}
name = substr(each.key, 0, 15) # Charcter lengh for linux - 62 and windows - 15
lab_name = azurerm_dev_test_lab.main.name
resource_group_name = local.resource_group_name
location = local.location
Parameters
-
allow_claim
optional - bool -
disallow_public_ip_address
optional - bool -
fqdn
optional computed - string -
id
optional computed - string -
lab_name
required - string -
lab_subnet_name
required - string -
lab_virtual_network_id
required - string -
location
required - string -
name
required - string -
notes
optional - string -
password
required - string -
resource_group_name
required - string -
size
required - string -
storage_type
required - string -
tags
optional - map from string to string -
unique_identifier
optional computed - string -
username
required - string -
gallery_image_reference
list block -
inbound_nat_rule
set block-
backend_port
required - number -
frontend_port
optional computed - number -
protocol
required - string
-
-
timeouts
single block
Explanation in Terraform Registry
Manages a Windows Virtual Machine within a Dev Test Lab.
Microsoft.DevTestLab/labs/virtualmachines (Azure Resource Manager)
The labs/virtualmachines in Microsoft.DevTestLab can be configured in Azure Resource Manager with the resource name Microsoft.DevTestLab/labs/virtualmachines
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"labs_lab1_name": {
Parameters
apiVersion
required - stringlocation
optional - stringThe location of the resource.
name
required - stringThe name of the virtual machine.
properties
requiredallowClaim
optional - booleanIndicates whether another user can take ownership of the virtual machine
artifacts
optional arrayartifactId
optional - stringThe artifact's identifier.
artifactTitle
optional - stringThe artifact's title.
deploymentStatusMessage
optional - stringThe status message from the deployment.
installTime
optional - stringThe time that the artifact starts to install on the virtual machine.
parameters
optional arrayname
optional - stringThe name of the artifact parameter.
value
optional - stringThe value of the artifact parameter.
status
optional - stringThe status of the artifact.
vmExtensionStatusMessage
optional - stringThe status message from the virtual machine extension.
createdDate
optional - stringThe creation date of the virtual machine.
customImageId
optional - stringThe custom image identifier of the virtual machine.
dataDiskParameters
optional arrayattachNewDataDiskOptions
optionaldiskName
optional - stringThe name of the disk to be attached.
diskSizeGiB
optional - integerSize of the disk to be attached in Gibibytes.
diskType
optional - stringThe storage type for the disk (i.e. Standard, Premium).
existingLabDiskId
optional - stringSpecifies the existing lab disk id to attach to virtual machine.
hostCaching
optional - stringCaching option for a data disk (i.e. None, ReadOnly, ReadWrite).
disallowPublicIpAddress
optional - booleanIndicates whether the virtual machine is to be created without a public IP address.
environmentId
optional - stringThe resource ID of the environment that contains this virtual machine, if any.
expirationDate
optional - stringThe expiration date for VM.
galleryImageReference
optionaloffer
optional - stringThe offer of the gallery image.
osType
optional - stringThe OS type of the gallery image.
publisher
optional - stringThe publisher of the gallery image.
sku
optional - stringThe SKU of the gallery image.
version
optional - stringThe version of the gallery image.
isAuthenticationWithSshKey
optional - booleanIndicates whether this virtual machine uses an SSH key for authentication.
labSubnetName
optional - stringThe lab subnet name of the virtual machine.
labVirtualNetworkId
optional - stringThe lab virtual network identifier of the virtual machine.
networkInterface
optionaldnsName
optional - stringThe DNS name.
privateIpAddress
optional - stringThe private IP address.
publicIpAddress
optional - stringThe public IP address.
publicIpAddressId
optional - stringThe resource ID of the public IP address.
rdpAuthority
optional - stringThe RdpAuthority property is a server DNS host name or IP address followed by the service port number for RDP (Remote Desktop Protocol).
sharedPublicIpAddressConfiguration
optionalinboundNatRules
optional arraybackendPort
optional - integerThe port to which the external traffic will be redirected.
frontendPort
optional - integerThe external endpoint port of the inbound connection. Possible values range between 1 and 65535, inclusive. If unspecified, a value will be allocated automatically.
transportProtocol
optional - stringThe transport protocol for the endpoint.
sshAuthority
optional - stringThe SshAuthority property is a server DNS host name or IP address followed by the service port number for SSH.
subnetId
optional - stringThe resource ID of the sub net.
virtualNetworkId
optional - stringThe resource ID of the virtual network.
notes
optional - stringThe notes of the virtual machine.
ownerObjectId
optional - stringThe object identifier of the owner of the virtual machine.
ownerUserPrincipalName
optional - stringThe user principal name of the virtual machine owner.
password
optional - stringThe password of the virtual machine administrator.
planId
optional - stringThe id of the plan associated with the virtual machine image
scheduleParameters
optional arrayname
optional - stringThe name of the virtual machine or environment
properties
optionaldailyRecurrence
optionaltime
optional - stringThe time of day the schedule will occur.
hourlyRecurrence
optionalminute
optional - integerMinutes of the hour the schedule will run.
notificationSettings
optionalemailRecipient
optional - stringThe email recipient to send notifications to (can be a list of semi-colon separated email addresses).
notificationLocale
optional - stringThe locale to use when sending a notification (fallback for unsupported languages is EN).
status
optional - stringIf notifications are enabled for this schedule (i.e. Enabled, Disabled).
timeInMinutes
optional - integerTime in minutes before event at which notification will be sent.
webhookUrl
optional - stringThe webhook URL to which the notification will be sent.
status
optional - stringThe status of the schedule (i.e. Enabled, Disabled).
targetResourceId
optional - stringThe resource ID to which the schedule belongs
taskType
optional - stringThe task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart).
timeZoneId
optional - stringThe time zone ID (e.g. Pacific Standard time).
weeklyRecurrence
optionaltime
optional - stringThe time of the day the schedule will occur.
weekdays
optional - arrayThe days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.).
tags
optional - stringThe tags of the resource.
size
optional - stringThe size of the virtual machine.
sshKey
optional - stringThe SSH key of the virtual machine administrator.
storageType
optional - stringStorage type to use for virtual machine (i.e. Standard, Premium).
userName
optional - stringThe user name of the virtual machine.
tags
optional - stringThe tags of the resource.
type
required - string
Frequently asked questions
What is Azure Dev Test Windows Virtual Machine?
Azure Dev Test Windows Virtual Machine is a resource for Dev Test of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure Dev Test Windows Virtual Machine?
For Terraform, the ranibharti30/Assignments, niveklabs/azurerm and kevinhead/azurerm source code examples are useful. See the Terraform Example section for further details.
For Azure Resource Manager, the henrikmotzkus/AzureShortcuts source code example is useful. See the Azure Resource Manager Example section for further details.