In this lab we will use Chef to configure Azure DevTest Lab virtual machines in Azure.

DevOps MPP Course Source

Pre-requisites:

Lab Tasks:

  • Create a DevTest Lab
  • Configure DevTest Lab

Estimated Lab Time:

  • approx. 30 minutes

Task 1: Create DevTest Lab

  1. From the Azure portal, click Create a Resource. On the New blade, type DevTest Labs and when DevTest Labs appears click on it, read the text on the DevTest Lab blade and click Create

  2. From the Create a DevTest Lab blade, create a DevTest lab with the following settings:

    • Lab name: DevTestLab1
    • Subscription: your Azure subscription
    • Location: an Azure region close to the lab location
    • Auto-shutdown: Disabled

Task 2: Configure DevTest Lab

  1. In the Azure portal, navigate to DevTestLab1 and, on the DevTestLab1 blade, click Configuration and policies.
  2. In the POLICY SETTINGS section, click Allowed virtual machine sizes.
  3. Enable the Allowed virtual machine sizes setting and limit the size choice to Standard D2_V2 only.
  4. In the POLICY SETTINGS section, click Virtual machines per user.
  5. Limit the number of virtual machines per user to 1.
  6. In the POLICY SETTINGS section, click Virtual machines per lab.
  7. Limit the number of virtual machines per lab to 5. 8 In the SCHEDULES section, click Auto-shutdown.
  8. Set the auto-shutdown to take place at 7:00PM your local time.
  9. In the SCHEDULES section, click Auto-start.
  10. Set the auto-start to take place at 7:00AM your local time on weekdays.
  11. In the EXTERNAL RESOURCES section, click Virtual networks.

  12. Note that the lab includes an auto-generated virtual network. You can modify its configuration, if needed. You can also customize the default behavior, which automatically assigns to VMs a shared public IP address.
  13. In the EXTERNAL RESOURCES section, click Repositories.
  14. Note that the lab is pre-configured with a Public Repo referencing https://github.com/Azure/azure-devtestlab.git , which includes artifacts and Azure Resource Manager templates you can use for VM deployment. You have the option of creating your own repositories (you can start by cloning the Public Repo).
  15. In the VIRTUAL MACHINE BASES section, click Marketplace images.
  16. Note that you have the option of modifying the default configuration, which allows al Azure Marketplace images as virtual machine bases and instead limiting selection to specific images only.
  17. In the VIRTUAL MACHINE BASES section, click Custom images (VHDs).
  18. Note that you have the option of uploading custom images for lab VM deployment.
  19. Scroll back to the DevTestLab1 blade and click My secrets
  20. Create a secret named WS2016Password with the value Pa55w.rd1234
  21. On the DevTestLab1 blade, click Formulas (reusable bases).
  22. Click Add and, on the Choose a base blade, click Windows Server 2016 Datacenter.

  23. On the Create formula (reusable bases) blade, specify the following:
    • Formula name: WS2016DatacenterLabVM
    • Description: Windows Server 2016 Datacenter Lab VM
    • User name: student
    • Password: WS2016Password
    • Disk and size: accept the default (this is enforced via the Allowed virtual machine sizes setting you chose earlier)
    • Virtual machine size: accept the default (this is enforced via the Allowed virtual machine sizes setting you chose earlier)
    • Artifacts: Chef Client
    • Chef Node Name: labVM
    • Chef Server URL: https://’fully_qualified_domain_name’/organizations/cheflabs where ’fully_qualified_domain_name’ represents the fully qualified DNS name of the Chef Server Azure VM
    • validation Client Name: cheflabs-validator
    • validation Key: browse to the Downloads\chef-starter\chef- repo.chef\cheflabs-validator.pem)
    • Run List: recipe[learn_chef_iis]
    • Client Configuration File: leave blank
    • SSL Verification Mode: none
    • Chef environment tag: _default
    • Encrypted databag secret: leave blank
    • Chef Server SSL Certificate: leave blank
    • Advanced settings: leave at their defaults
  24. In the MY LAB section, click My virtual machines and then click Add.
  25. On the Choose a base blade, click WS2016DataCenterLabVM formula.
  26. On the Virtual machine name, in the Virtual machine name textbox, type labVM0, accept all remaining settings with their default values and click Artifacts.
  27. On the Add artifacts blade, click the link 1 artifact(s) selected.
  28. On the Selected artifacts blade, click Chef Client.
  29. On the Add artifact blade, set the Chef Node Name value to labVM0, verify that the validation key is set to Downloads\chef-starter\chef-repo.chef\cheflabs-validator.pem, and click OK.
  30. On the Selected artifacts blade, click OK.
  31. On the Add artifacts blade, click OK.
  32. On the Virtual machine blade, click Create.
  33. Wait for the lab VM to be provisioned. Switch to the Chrome window and click the Nodes tab to verify that a newly provisioned VM is configured as a Chef client.

Summary

In this lab you have craeted and configured DevTest Labs