Azure Discovery Day Lab Guide
Azure Discovery Day Lab Guide
Contents
Objectives of lab tasks ................................................................................................................................................... 3
Pre-requisites .................................................................................................................................................................. 3
Task 1 – Creating an Azure Virtual Machine ............................................................................................................... 4
First look at Azure portal ........................................................................................................................................... 4
Creating a resource group......................................................................................................................................... 5
Creating a virtual machine with Azure Portal ......................................................................................................... 7
Logging in to virtual machine and setting up Visual Studio .............................................................................. 14
Task 2 – Creating a Linux virtual machine in Azure.................................................................................................. 16
Activating Azure PowerShell in Azure Portal ........................................................................................................ 16
Creating a Linux VM using PowerShell commands.............................................................................................. 17
Task 3 - Deploy a Linux Container in Azure Container Instances........................................................................... 22
Creating a Resource Group ..................................................................................................................................... 22
Configure Azure Container Instances .................................................................................................................... 23
Task 4 - Deploy a Windows Container in Azure Container Instances.................................................................... 28
........................................................................................................................................................................................ 30
Page 2 of 32
Azure
Task 1 aims to get you familiar with how resources on Azure and Azure portal are organized and how to
access and create resources. At the end of task 1, you should have access to a functional virtual machine with
Visual Studio running on Azure.
Task 2 aims to broaden your options in creating Azure resources and managing scalable compute resources.
Issuing instructions through scripting tools such as PowerShell and Azure command line interface (CLI) is a
scalable way of automating the deployment of infrastructure. Task 2 introduces you to the concept of
infrastructure as code and how to create / manage a virtual machine scale set.
Task 3 & Task4 aims to show you a different way of deploying and managing your workloads through Azure
Container Instances (ACI). Azure Container Instances offers the fastest and simplest way to run a
container in Azure, without having to manage any virtual machines and without having to adopt a
higher-level service.
• Task 3 aims to introduce you to Docker Hub, the public registry where you can find Container Images
which can be easily deployed within Azure Container Instances without the need to setup or provision
underlying platform. The scenario demonstrates bringing up a Linux Container with a fully functioning
game on it.
• Task 4 aims to use Microsoft’s Container registry used to publish its official images. The scenario
demonstrates a Windows Nano Server with IIS on it.
Pre-requisites
To participate in the hands-on-lab, you need
Page 3 of 32
Azure
The search box allows you to search for features to create resources or access existing resources you have
already created.
The notifications toggle shows / hides the notifications pane that will let you know just-in-time information such
as when resources are being created or when they are successfully or unsuccessfully created.
The terminal toggle brings up a web-based command line interface (CLI) that allows you to directly input
commands to effect changes to your Azure subscription, without the need for a separate OS or shell.
Page 4 of 32
Azure
The settings icon lets you customize the interface of your Azure portal.
The feedback icon lets you send feedback of your experiences throughout the Azure portal.
The help icon gives you a shortcut to access support tickets and resources. Note that Help + support is
also available from the left pane.
The directory + subscription icon lets you toggle and filter between various subscriptions if you have
more than one.
To create a resource group, click Resource groups on the left side bar and click + Add.
Page 5 of 32
Azure
In the new pane that appears, fill in a relevant resource group name. For this guide, we can use Task1.
Make sure to use the correct subscription. If you followed the pre-requisite defaults, it should be Free
Trial.
We will create all our resources in Southeast Asia as Southeast Asia region’s datacenters are physically located
in Singapore. We will not be using Tags for this lab and hence we can skip it. After that, click Review +
Create and click on Create.
Page 6 of 32
Azure
The concept of running a virtual machine (VM) on Azure is very similar to that of doing the same on premise.
You choose an operating system or image, configure the compute, network and storage, and run the VM.
Azure virtual machines support a wide range of operating systems including but not limited to Windows Server,
Windows 10, RedHat Enterprise Linux, Ubuntu, SUSE Linux Enterprise Server, CentOS and more.
During the VM creation, we will be creating the required network and storage resources. A virtual network is an
emulation of a physical network. It is not to be confused with virtual private network (VPN). A virtual network
acts like a local intranet network so Azure resources can communicate privately. This virtual network can be
extended to your on-premise servers and VMs through an Azure ExpressRoute.
Click Virtual machines on the left side bar and then click + Add.
In the Create virtual machine wizard, you will see there are 6 steps – Basics, Disks, Networking,
Management, Guest config and Tags.
Page 7 of 32
Azure
Page 8 of 32
Azure
1. Make sure to use the correct subscription. If you followed the pre-requisite defaults, it should be
Free Trial.
2. We will use our existing Task1 resource group to provision our VM.
3. Give your VM a relevant name.
4. Make sure location is set as Southeast Asia.
5. Select “No infrastructure redundancy required” for Availability Options as we will not configure high
availability.
6. For image option, Click on Browse all images and disks.
a. In the Select an image page, search for Visual Studio Community and choose Visual Studio
Community 2017(latest release) on Windows Server 2016 (x64)
7. For Size, click on Change size and select D2s_v3 for VM size. This SKU comes with 2 virtual CPUs and
8 GB of RAM – sufficient for this lab. Do not choose anything lower. Click on Select.
If you have trouble coming up with a password, you can use @MsFt.c0M#ADD
9. We will skip Inbound Port Rules for now.
10. For this lab, we will select No for Save money.
If your organization has an enterprise agreement with Microsoft and you have unused Windows Server
licenses, you may get up to 40% on monthly Windows Server VM billing on Azure. Find out more about
the Azure Hybrid Use Benefit (AHUB).
11. Click Next : Disks >.
Page 9 of 32
Azure
Step 2: Disks
Page 10 of 32
Azure
Step 3: Networking
Page 11 of 32
Azure
a. Give your virtual network a relevant name. This field does not have to be unique across Azure.
b. You can configure the address space per your needs. For this lab, we will use the default
10.0.0.0/16
c. Give your subnet a relevant name. This field does not have to be unique across Azure.
d. You can configure the address range per your needs. For this lab, we will use the default
10.0.0.0/16.
e. Click on OK.
2. A new public IP address will be created and assigned to the VM.
3. We will customize the NIC network security group [NSG]. An NSG is essentially a set of firewall
definitions on which ports to open for inbound and outbound traffic.
a. Verify Network security group setting is set to Basic
b. In Public inbound ports, select Allow selected ports
c. Under Select inbound ports, select RDP (3389) from the dropdown
4. Leave the rest of the settings to default value and click on Next : Management >
Step 5: Management
A common cause of high billing is VMs are left running when not in use. This is especially true for DevTest VMs
which may not be used beyond working hours. Since the VM we are creating is not for production but for
training, we will schedule our VM to auto-shutdown at 7pm UTC+8. When a VM is in shutdown state (via the
Azure portal), you will not be billed for compute hours.
Note that to properly shut down a VM such that you are not billed, you need to shut down the VM through the
Azure portal or PowerShell / CLI commands. Shutting down the OS via RDP will not release the compute
resources allocated to your VM and hence you will continue to be billed.
Toggling the notification before shutdown is entirely up to your own preference. Selecting on will result in
you receiving an email notifying you your VM is about the shut down before the shutdown time.
We will leave the pre-populated monitoring and managed service identity settings as is.
Leave the rest of the settings as default and click on Review + create.
Page 12 of 32
Azure
Page 13 of 32
Azure
Once the virtual machine has been successfully created, you should be automatically brought to the overview
tab of the VM. If not, navigate to Virtual machines on the left pane and click into the VM you just created.
In the overview tab, find the Public IP address and copy it to your clipboard.
Open a remote desktop client. On Windows, launch Remote Desktop Connection from the start menu.
On macOS, you need to download the Microsoft Remote Desktop app from the App Store.
Paste the IP address you just copied into the Computer field in Remote Desktop Connection.
Click Yes if you encounter a popup asking you to accept the certificate of the remote computer.
Page 14 of 32
Azure
If you forgot your username or password, you may, in the Azure portal, navigate out of the overview tab and into
the Reset password pane to configure a new set of username and password.
Page 15 of 32
Azure
In the Azure portal, click the Cloud Shell icon on the top bar.
In the newly opened window at the bottom of the browser, click PowerShell. Note that you can also create a Bash
cloud shell to execute CLI commands. Choosing one doesn’t mean you forgo the other. You can always access the
Bash cloud shell later.
Page 16 of 32
Azure
After a minute, you will be presented with the PowerShell command interface. We will now proceed to creating
a VM using PowerShell commands.
We will start by creating a new resource group that will hold our virtual machine. But, before creating resource
group lets assign few variables that can hold values of resource group, location and virtual machine name.
Execute the below commands one by one:
Page 17 of 32
Azure
After setting the variables for resource group, let us set variables for secure password and username using the
below commands
With variables set, we can create Resource group by executing the following command,
Next step in the VM creation process is configuring subnet with required range of addresses and subnet name
of user’s choice.
Create VNET using subnet configuration created in the previous step and assign name for VNET
After the execution of command, a warning might be thrown, and it can be ignored as it does not have any
major impact towards to intent of this lab.
Page 18 of 32
Azure
Now assign a Public IP Address using a unique name. Note that the Get-Random function here is used to
create a random value, making sure that the generated name is unique.
Next step is to create Network Security Group and open the ports that are necessary for this VM. Since this is a
Linux VM, open the port #22 for inbound traffic.
Creating network security group is a 2-step process. After configuring NSG Rule using previous command,
Network Security Group creation becomes complete with the following command:
The final step before creating VM is to create the Network Interface Card and associate with Public IP address
and Network Security Group created in the earlier steps:
# Create a virtual network card and associate with public IP address and NSG
$nic = New-AzureRmNetworkInterface -Name myNic -ResourceGroupName $resourceGroup -
Location $location `
-SubnetId $vnet.Subnets[0].Id -PublicIpAddressId $pip.Id -NetworkSecurityGroupId
$nsg.Id
Page 19 of 32
Azure
Set the VM Configuration variable using VM Name, OS Name, Credentials and server name.
While the above command gets executed, the subsequent warning can be ignored; but verify that the status
code is OK, which indicates that VM creation is successful.
Once installation is completed, you can navigate back to Azure Portal and Identify the Linux VM that has just
been created and make a note of Public IP address of VM.
Page 20 of 32
Azure
After identifying Public IP address of Linux VM, download putty client from https://www.putty.org/. Launch Putty
and provide your VM credentials (username + password) and it will allow you to access the VM.
Page 21 of 32
Azure
Click on Add
Page 22 of 32
Click on ‘Review + Create’ and ‘Create’
Click on Add
Page 23 of 32
Fill in the details on the Basic Tab as below
*Docker Hub is a Public Repository of Images that can be used to deploy in Azure Container Instances. The URL
or Docker Hub Tag helps to uniquely identify an image.
Page 24 of 32
Notification Pops Up on Deployment in Progress
Page 25 of 32
The Container shows up in ACI and indicates the status as ‘Creating’
View the Container Events and it lists Pulling, Pulled, Started, Created
Page 26 of 32
Access the Public IP address from the Browser
IP Address: Port Number
Page 27 of 32
Task 4 - Deploy a Windows Container in Azure Container Instances
Search for Container Instances
Click on Add
Page 28 of 32
Page 29 of 32
Click on OK
Page 30 of 32
Select the IIS Server
Open the Overview Pane and copy the IP Address see on your terminal
Page 31 of 32
Enter the IP Address on the Browser – View the Landing Page of IIS
Page 32 of 32