Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Azure icon
Labs

Deploying Azure Templates with Visual Studio Code

In this lab, we use a Windows 2019 Server with Visual Studio Code to deploy an Azure QuickStart template. We have been asked to deploy a Ubuntu virtual machine for the developer team to test a new application. The developers have requested a standard B2S virtual machine with TCP ports 443 open to the internet both on inbound and outbound channels.

Azure icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 0m
Published
Clock icon Jan 31, 2020

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Provision Visual Studio 2019 Community Virtual Machine

    1. Click Home > + Create a resource.

    2. Search for "Visual Studio 2019 Community (latest release) on Windows 2019 Server (x64)".

    3. Click Create.

    4. Select the provided Resource Group.

    5. Enter Virtual machine name "VS-Studio-01".

    6. For Region, select (US) West US.

    7. For Availability Options, No infrastructure redundancy required.

    8. For Azure Spot Instance, No.

    9. For Size, Change Size, then select D3_v3.

    10. For Administrator Account, enter "Admin1234567" without the quotes for Username and Password.

    11. For Public inbound ports, Allow selected ports.

    12. Select the inbound ports RDP (3389).

    13. For Already have a Windows Server License?, select No.

    14. Click Next: Disks.

    15. Click Create and attach a new disk.

    16. Accept the defaults and click OK.

    17. Click Review and Create and then Create.

  2. Challenge

    Connect to Visual Studio Virtual Machine and Add Plugins

    1. Connect to VS-Studio-01 via RDP. Log in with Admin1234567 as the username and password.

    2. Open Visual Studio Code.

    3. Open Marketplace and install Azure CLI Tools.

    4. Install Azure Powershell Tools.

    5. Open the following website and click Install: https://marketplace.visualstudio.com/items?itemName=msazurermtools.azurerm-vscode-tools

    Note: All plugins are from Microsoft.

  3. Challenge

    Download and Modify "101-vm-simple-linux" Template from GitHub

    1. Open the 101-vm-simple-linux template from GitHub.

    2. Open raw view, then copy all.

    3. In Visual Studio Code, create a new local JSON file in VS Code called azuredeployment.json.

    4. Paste the copied template contents into azuredeployment.json.

    5. Create a file azuredeployment.parameters.json.

    6. Paste the template parameters from the RAW view.

    7. Save the parmeters file azuredeployment.parameters.json.

    8. Find line 27, make sure the following shows:

      "defaultValue": "password",
      
    9. Add a comma after the brackets underneath securityRules.

    10. Select all of the information under securityRules, including the brackets (but not the comma). Copy it and paste it on the line after the comma in the previous step.

    11. Change the following fields.

      • "name": "SSL",
      • "priority": 1001,
      • "destinationPortRange": "443"
    12. Save the tenplate azuredeployment.json.

  4. Challenge

    Configure Azure Cloud Shell

    Click the [>_] Icon on the blue Azure bar.

    1. Click PowerShell, then Show advanced settings.
    2. Change Cloud Shell Region to West US.
    3. Set Resource group to Use existing.
    4. Use build a unique Storage account and File share by using the following:
      • lalab446mmddyyyy (use the 8-digit date or mmddyyyy, e.g. la44601212020)
    5. Click Create Storage.

    If successful, you should see something similar to:

    Your cloud drive has been created in:
        
    Subscription Id: 4cedc5dd-e3ad-468d-bf66-32e31bdb9148
    Resource group:  212-e743b5-deploying-azure-templates-with-cloud-shell-6gd
    Storage account: la44601212020
    File share:      la44601212020
    
    Initializing your account for Cloud Shell...
    Requesting a Cloud Shell.Succeeded.
    Connecting terminal...
    
    Welcome to Azure Cloud Shell
    
    Type "az" to use Azure CLI
    Type "help" to learn about Cloud Shell
            
    linuxacademy@Azure:~$
    
  5. Challenge

    Configure Template Storage and Upload

    Select the unique Storage account created with the following: lalab446mmddyyyy

    1. Under Settings in the left-hand menu, click Configuration.
    2. Set Allow Blob public access to Enabled.
    3. Under Blob service in the left-hand menu, click Containers.
    4. Click + Container to add a new container.
    5. Enter "templates" into the Name box.
    6. Set Public access level to Blob (anonymous read access for blobs only).
    7. Click Create.
    8. Double-click the templates folder.
    9. Upload both azuredeployment and azuredeployment.parameters.
    10. Double-click the link for azuredeployment.json.
    11. Copy the URL to the clipboard.
  6. Challenge

    Deploy Azure Template via Azure Cloud Shell

    1. In the Cloud Shell window, run the following command:

      Get-AzResourceGroup
      

      This should return a response similar to the following:

       PS Azure:\> Get-AzResourceGroup
      
          ResourceGroupName : 210-c1eed6-deploying-azure-templates-with-visual-studio-xti
           Location          : westus
       Tags              :
       ResourceId        : /subscriptions/4cedc5dd-e3ad-468d-bf66-32e31bdb9148/resourceGroups/210-c1eed6-deploying-azure-templates-with-visual-studio-xti 
      
    2. Create the deployment. Remember to replace the RESOURCE_GROUP_NAME and the URL_COPIED_IN_THE_PREVIOUS_TASK with the appropriate values.

      az group deployment create -g RESOURCE_GROUP_NAME --template-uri URL_COPIED_IN_THE_PREVIOUS_TASK
      

    If successful, we will get a success message.

  7. Challenge

    Deployment Validation

    1. Once the deployment is complete, click All resources in the Azure portal.
    2. Click simpleLinuxVM.
    3. Under Settings, click Networking.
    4. Verify the existence of the SSL rule.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans