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.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Provision Visual Studio 2019 Community Virtual Machine
Click Home > + Create a resource.
Search for "Visual Studio 2019 Community (latest release) on Windows 2019 Server (x64)".
Click Create.
Select the provided Resource Group.
Enter Virtual machine name "VS-Studio-01".
For Region, select (US) West US.
For Availability Options, No infrastructure redundancy required.
For Azure Spot Instance, No.
For Size, Change Size, then select B2s.
For Administrator Account, enter "Admin1234567" without the quotes for Username and Password.
For Public inbound ports, Allow selected ports.
Select the inbound ports RDP (3389).
For Already have a Windows Server License?, select No.
Click Next: Disks.
Click Create and attach a new disk.
Accept the defaults and click OK.
Click Review and Create and then Create.
- Connect to Visual Studio Virtual Machine and Add Plugins
Connect to VS-Studio-01 via RDP. Log in with
Admin1234567
as the username and password.Open Visual Studio Code.
Open Marketplace and install Azure CLI Tools.
Install Azure Powershell Tools.
Open the following website and click Install:
https://marketplace.visualstudio.com/items?itemName=msazurermtools.azurerm-vscode-tools
Note: All plugins are from Microsoft.
- Download and Modify “101-vm-simple-linux” Template from GitHub
- Open the
101-vm-simple-linux
template from GitHub.
Open raw view, then copy all.
In Visual Studio Code, create a new local JSON file in VS Code called
azuredeployment.json
.Paste the copied template contents into
azuredeployment.json
.Create a file
azuredeployment.parameters.json
.Paste the template parameters from the RAW view.
Save the parmeters file
azuredeployment.parameters.json
.Modify the
azuredeployment.json
file to add theSSL Inbound Allow
.- Copy from line 148 to line 159.
- Change Line 159 to
},
then hitReturn
. - On Line 160, paste the copied lines.
- Change
name
to"SSL"
. - Change
priority
to1001,
. - Change
destinationPortRange
to"443"
.
Change Line 20
Authentication Type
to"password"
Save the tenplate
azuredeployment.json
.
- Open the
- Configure Azure Cloud Shell
Click the [>_] Icon on the blue Azure bar.
- Click PowerShell, then Show advanced settings.
- Change Cloud Shell Region to West US.
- Set Resource group to Use existing.
- Use build a unique Storage account and File share by using the following:
- lalab446mmddyyyy (use the 8-digit date or mmddyyyy, e.g.
la44601212020
)
- lalab446mmddyyyy (use the 8-digit date or mmddyyyy, e.g.
- 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:~$
- Configure Template Storage and Upload
Select the unique Storage account created with the following:
lalab446mmddyyyy- Under Settings in the left-hand menu, click Configuration.
- Set Allow Blob public access to Enabled.
- Under Blob service in the left-hand menu, click Containers.
- Click + Container to add a new container.
- Enter "templates" into the Name box.
- Set Public access level to Blob (anonymous read access for blobs only).
- Click Create.
- Double-click the templates folder.
- Upload both
azuredeployment
andazuredeployment.parameters
. - Double-click the link for azuredeployment.json.
- Copy the URL to the clipboard.
- Deploy Azure Template via Azure Cloud Shell
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
Create the deployment. Remember to replace the
RESOURCE_GROUP_NAME
and theURL_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.
- Deployment Validation
- Once the deployment is complete, click All resources in the Azure portal.
- Click simpleLinuxVM.
- Under Settings, click Networking.
- Verify the existence of the SSL rule.