Skip to main content

Azure DevTest Labs: Set expiration date for a virtual machine

Published date: August 02, 2016

In Azure DevTest Labs, you can now set an expiration date and time for a virtual machine. The VM will be deleted within 24 hours of the specified date and time. The time is in UTC.

You can do this by using an Azure Resource Manager template—namely, by specifying the expirationDate property for the VM that will be created in the lab. You can check out a sample Resource Manager template in our public GitHub repository. You can also modify any of the existing sample Resource Manager templates for the VM creation (name starting with 101-dtl-create-vm) by specifying the expirationDate property as follows.

"resources": [
    {
      "apiVersion": "2016-05-15",
      "type": "Microsoft.DevTestLab/labs/virtualMachines",
      "name": "[variables('resourceName')]",
      "location": "[resourceGroup().location]",
      "properties": {
        "customImageId": "[parameters('existingCustomImageId')]",
        "size": "[parameters('newVMSize')]",
        "isAuthenticationWithSshKey": false,
        "userName": "[parameters('userName')]",
        "sshKey": "",
        "password": "[parameters('password')]",
        "labVirtualNetworkId": "[variables('labVirtualNetworkId')]",
        "labSubnetName": "[variables('labSubnetName')]",
        "expirationDate": "[parameters('expirationDate')]"
      }
 
    }
  ],

 

Please try the new feature and let us know how we can make it better by sharing your ideas and suggestions at the DevTest Labs feedback forum.

If you run into any problems with the feature or have any questions, we are always ready to help you at our MSDN forum.

 

 

 

  • Virtual Machines
  • Azure DevTest Labs
  • Features
  • Services