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

Main.tf#L52
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"
main.tf#L7
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
main.tf#L7
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
main.tf#L104
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

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

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

test.json
{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "labs_lab1_name": {

Parameters

  • apiVersion required - string
  • location optional - string

    The location of the resource.

  • name required - string

    The name of the virtual machine.

  • properties required
      • allowClaim optional - boolean

        Indicates whether another user can take ownership of the virtual machine

      • artifacts optional array
          • artifactId optional - string

            The artifact's identifier.

          • artifactTitle optional - string

            The artifact's title.

          • deploymentStatusMessage optional - string

            The status message from the deployment.

          • installTime optional - string

            The time that the artifact starts to install on the virtual machine.

          • parameters optional array
              • name optional - string

                The name of the artifact parameter.

              • value optional - string

                The value of the artifact parameter.

          • status optional - string

            The status of the artifact.

          • vmExtensionStatusMessage optional - string

            The status message from the virtual machine extension.

      • createdDate optional - string

        The creation date of the virtual machine.

      • customImageId optional - string

        The custom image identifier of the virtual machine.

      • dataDiskParameters optional array
          • attachNewDataDiskOptions optional
              • diskName optional - string

                The name of the disk to be attached.

              • diskSizeGiB optional - integer

                Size of the disk to be attached in Gibibytes.

              • diskType optional - string

                The storage type for the disk (i.e. Standard, Premium).

          • existingLabDiskId optional - string

            Specifies the existing lab disk id to attach to virtual machine.

          • hostCaching optional - string

            Caching option for a data disk (i.e. None, ReadOnly, ReadWrite).

      • disallowPublicIpAddress optional - boolean

        Indicates whether the virtual machine is to be created without a public IP address.

      • environmentId optional - string

        The resource ID of the environment that contains this virtual machine, if any.

      • expirationDate optional - string

        The expiration date for VM.

      • galleryImageReference optional
          • offer optional - string

            The offer of the gallery image.

          • osType optional - string

            The OS type of the gallery image.

          • publisher optional - string

            The publisher of the gallery image.

          • sku optional - string

            The SKU of the gallery image.

          • version optional - string

            The version of the gallery image.

      • isAuthenticationWithSshKey optional - boolean

        Indicates whether this virtual machine uses an SSH key for authentication.

      • labSubnetName optional - string

        The lab subnet name of the virtual machine.

      • labVirtualNetworkId optional - string

        The lab virtual network identifier of the virtual machine.

      • networkInterface optional
          • dnsName optional - string

            The DNS name.

          • privateIpAddress optional - string

            The private IP address.

          • publicIpAddress optional - string

            The public IP address.

          • publicIpAddressId optional - string

            The resource ID of the public IP address.

          • rdpAuthority optional - string

            The RdpAuthority property is a server DNS host name or IP address followed by the service port number for RDP (Remote Desktop Protocol).

          • sharedPublicIpAddressConfiguration optional
              • inboundNatRules optional array
                  • backendPort optional - integer

                    The port to which the external traffic will be redirected.

                  • frontendPort optional - integer

                    The 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 - string

                    The transport protocol for the endpoint.

          • sshAuthority optional - string

            The SshAuthority property is a server DNS host name or IP address followed by the service port number for SSH.

          • subnetId optional - string

            The resource ID of the sub net.

          • virtualNetworkId optional - string

            The resource ID of the virtual network.

      • notes optional - string

        The notes of the virtual machine.

      • ownerObjectId optional - string

        The object identifier of the owner of the virtual machine.

      • ownerUserPrincipalName optional - string

        The user principal name of the virtual machine owner.

      • password optional - string

        The password of the virtual machine administrator.

      • planId optional - string

        The id of the plan associated with the virtual machine image

      • scheduleParameters optional array
          • name optional - string

            The name of the virtual machine or environment

          • properties optional
              • dailyRecurrence optional
                  • time optional - string

                    The time of day the schedule will occur.

              • hourlyRecurrence optional
                  • minute optional - integer

                    Minutes of the hour the schedule will run.

              • notificationSettings optional
                  • emailRecipient optional - string

                    The email recipient to send notifications to (can be a list of semi-colon separated email addresses).

                  • notificationLocale optional - string

                    The locale to use when sending a notification (fallback for unsupported languages is EN).

                  • status optional - string

                    If notifications are enabled for this schedule (i.e. Enabled, Disabled).

                  • timeInMinutes optional - integer

                    Time in minutes before event at which notification will be sent.

                  • webhookUrl optional - string

                    The webhook URL to which the notification will be sent.

              • status optional - string

                The status of the schedule (i.e. Enabled, Disabled).

              • targetResourceId optional - string

                The resource ID to which the schedule belongs

              • taskType optional - string

                The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart).

              • timeZoneId optional - string

                The time zone ID (e.g. Pacific Standard time).

              • weeklyRecurrence optional
                  • time optional - string

                    The time of the day the schedule will occur.

                  • weekdays optional - array

                    The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.).

          • tags optional - string

            The tags of the resource.

      • size optional - string

        The size of the virtual machine.

      • sshKey optional - string

        The SSH key of the virtual machine administrator.

      • storageType optional - string

        Storage type to use for virtual machine (i.e. Standard, Premium).

      • userName optional - string

        The user name of the virtual machine.

  • tags optional - string

    The 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.