0% found this document useful (0 votes)
6 views

Lab10 - Capturing existing VM _ build new VM with customized Image using Managed Disks - Azure

Uploaded by

raj0000kaml
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Lab10 - Capturing existing VM _ build new VM with customized Image using Managed Disks - Azure

Uploaded by

raj0000kaml
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 71

Cloud Computing - Azure

Lab10 – Capturing existing VM & build new VM with customized


Image using Managed Disks

Managed disks

Managed Disks handles the storage account creation/management in the background


for you, and ensures that you do not have to worry about the scalability limits of the
storage account. You simply specify the disk size and the performance tier
(Standard/Premium), and Azure creates and manages the disk for you. As you add disks
or scale the VM up and down, you don't have to worry about the storage being used.

You can also manage your custom images in one storage account per Azure region, and
use them to create hundreds of VMs in the same subscription. For more information
about Managed Disks, see the Managed Disks Overview.

We recommend that you use Azure Managed Disks for new VMs, and that you convert
your previous unmanaged disks to managed disks, to take advantage of the many
features available in Managed Disks.

Images

Managed Disks also support creating a managed custom image. You can create an image from your
custom VHD in a storage account or directly from a generalized (sys-prepped) VM. This process captures
in a single image all managed disks associated with a VM, including both the OS and data disks. This
managed custom image enables creating hundreds of VMs using your custom image without the need to
copy or manage any storage accounts.

Page 1 of 71
Cloud Computing - Azure

Topology

Page 2 of 71
Cloud Computing - Azure

In Azure portal, click on “Resource groups” in left side panel.

Page 3 of 71
Cloud Computing - Azure

Click “Add”.

Page 4 of 71
Cloud Computing - Azure

While creating “Resource group”.

Type “Resource group name” as “SansboundAzureClass”.

Select “Subscription” as “Free Trial”.

Select “Resource group location” as “South India”.

Then click “Create”.

Page 5 of 71
Cloud Computing - Azure

Click “Virtual networks” in left side panel.

Page 6 of 71
Cloud Computing - Azure

In “Virtual networks”

Click “Add”.

Page 7 of 71
Cloud Computing - Azure

While creating “Virtual network”.

Type “Virtual Network name” as “SANS-VNET”.

In “Address range” as 10.0.0.0/16.

Select “Subscription” as “Free Trial”.

Select “Resource group” as “SansboundAzureClass”.

Select “Region” as “South India”.

In “Subnet” type the name of the Subnet as “Sans-Pub-Subnet”.

In Subnet “Address range” type as 10.0.1.0/24.

Page 8 of 71
Cloud Computing - Azure

Click “Create”.

Page 9 of 71
Cloud Computing - Azure

Click “Virtual machines” in left side panel.

Page 10 of 71
Cloud Computing - Azure

In “Virtual machines”.

Click “Add” to create Virtual machine.

Page 11 of 71
Cloud Computing - Azure

While creating “Virtual machine”

Select “Subscription” as “Free Trial”.

Select “Resource Group” as “SansboundAzureClass”.

In “Virtual machine name” type “Ubuntu-AzureVM”.

Select “Region” as “South India”.

Select “Image” as “Ubuntu Server 18.04 LTS”.

Change “VM Size” as “Standard B1s”

Page 12 of 71
Cloud Computing - Azure

In “Administrator Account”

Set “Authentication type” as “Password”.

In “Username” type as “sansbound”.

In Password type the password for the Ubuntu server to access through SSH.

Page 13 of 71
Cloud Computing - Azure

In “Inbound Port Rules”

Set “Public inbound ports” as “Allow selected ports”.

Select “Select inbound ports” as “SSH” and “HTTP” Ports.

Because I am going to install apache web server in Ubuntu and capture the Ubuntu VM as Image, then
build a new VM with customized or captured image.

Page 14 of 71
Cloud Computing - Azure

Click “Next : Disks >”.

Page 15 of 71
Cloud Computing - Azure

In “Disks”

Ensure that you have selected “Managed disks”.

Page 16 of 71
Cloud Computing - Azure

Click “Next : Networking >”.

Page 17 of 71
Cloud Computing - Azure

In “Networking”

Ensure that “Virtual network” as “SANS-VNET”.

Ensure that “Subnet” as “Sans-Pub-Subnet” as 10.0.1.0/24

Public IP for Ubuntu-AzureVM.

Ensure “Network Security Group” as “Basic” / “Advanced”.

In “Public inbound ports” as “Allow selected ports”.

Ensure “Select inbound ports” as “SSH” and “HTTP” are allowed.

Page 18 of 71
Cloud Computing - Azure

Click “Next : Management >”.

Page 19 of 71
Cloud Computing - Azure

In “Management”

Click “Next : Guest config >”.

Page 20 of 71
Cloud Computing - Azure

In “Guest config”.

Click “Next : Tags >”.

Page 21 of 71
Cloud Computing - Azure

Click “Review + create”.

Page 22 of 71
Cloud Computing - Azure

Click “Create”.

Page 23 of 71
Cloud Computing - Azure

Click “Go to resource”.

Page 24 of 71
Cloud Computing - Azure

Kindly note the public address, we have required to access Ubuntu VM by using this IP only.

Page 25 of 71
Cloud Computing - Azure

Need to launch “Putty”.exe” from local machine and type the IP address of Ubuntu VM in Putty.

Click “Open” to connect Ubuntu server through SSH.

Page 26 of 71
Cloud Computing - Azure

Click “Yes”.

Page 27 of 71
Cloud Computing - Azure

Type username of Ubuntu as “sansbound” and press “Enter”.

Page 28 of 71
Cloud Computing - Azure

Type Password for the Ubuntu server and press “Enter”

Page 29 of 71
Cloud Computing - Azure

Now you have successfully logged into Ubuntu server.

Page 30 of 71
Cloud Computing - Azure

Now I have required to login as root user account.

Type “sudo –i” and press “Enter”.

Page 31 of 71
Cloud Computing - Azure

Now you have successfully logged as a root user.

Page 32 of 71
Cloud Computing - Azure

Now I have required to update packages.

Type “apt-get –y update” and press “Enter”.

Packages are successfully updated.

Page 33 of 71
Cloud Computing - Azure

Now we have required installing Apache in Ubuntu VM.

Type “apt-get install apache2” and press “Enter”.

Type “y” and press “Enter” to install the package.

Page 34 of 71
Cloud Computing - Azure

We have successfully installed Apache in Ubuntu.

Page 35 of 71
Cloud Computing - Azure

I have required customizing the default webpage.

Type “vi /var/www/html/index.html” and press “Enter”.

Page 36 of 71
Cloud Computing - Azure

Go to Line number “198”, then we have required to delete existing content and replace it as our own
wish.

Page 37 of 71
Cloud Computing - Azure

Delete the previous content

Then press “Insert” key

Type our content as “Sansbound Azure Class Page”.

Page 38 of 71
Cloud Computing - Azure

Press “Escape” key

Page 39 of 71
Cloud Computing - Azure

Then type in bottom line “:wq” and press “Enter” to save the file.

Page 40 of 71
Cloud Computing - Azure

Type public IP address of the Ubuntu in browser and then press “Enter”.

Now you have got the customized web page named as “Sansbound Azure Class Page”.

Page 41 of 71
Cloud Computing - Azure

Now we have required to “Capture” the existing Ubuntu Virtual machine.

In “Virtual machines”

Click “Ubuntu-AzureVM”.

Page 42 of 71
Cloud Computing - Azure

In “Ubuntu-AzureVM” you are able see that “Capture” option is available to capture the Virtual
Machine as “Image”. This feature is only available in Managed disks only.

Click “Capture”.

Page 43 of 71
Cloud Computing - Azure

While try to create “Image” it shows are warning message to complete prerequisite to run below
mentioned command in Ubuntu

“waagent –deprovision+user”

Page 44 of 71
Cloud Computing - Azure

In Ubuntu machine,

Type “waagent –deprovision+user” and press “Enter”.

Page 45 of 71
Cloud Computing - Azure

Data in entire home directory will be deleted.

Press “y” and press “Enter” to delete the home directory data.

Page 46 of 71
Cloud Computing - Azure

Select “Ubuntu-AzureVM” and click “Stop”.

Page 47 of 71
Cloud Computing - Azure

In “Ubuntu-AzureVM”.

Ensure that “Ubuntu-AzureVM” is in stopped state.

Click “Capture” to capture the Virtual machine.

Page 48 of 71
Cloud Computing - Azure

Type the Image name as “Ubuntu-SansWebServer”.

Select “Resource group” as “SansboundAzureClass”.

Page 49 of 71
Cloud Computing - Azure

Click “Create”.

You will get a message once you have successfully captured the virtual machine.

Page 50 of 71
Cloud Computing - Azure

Now, I have required to build a new virtual machine by using Captured image.

In “Virtual machines” click “Add” to create a new virtual machine.

Page 51 of 71
Cloud Computing - Azure

While creating Virtual machine,

Select “Subscription” as “Free Trial”.

Select “Resource group” as “SansboundAzureClass”.

In “Virtual machine name” type name as “Ubuntu-SansWebSvr2”.

Select “Region” as “South India”.

Page 52 of 71
Cloud Computing - Azure

In “Image” you have required to select customized image which you have captured by using Managed
disks. So click “Browse all images and disks”.

Page 53 of 71
Cloud Computing - Azure

You need to click on “My Items” to view your own images.

Page 54 of 71
Cloud Computing - Azure

Here you are able see the “Ubuntu-SansWebServer” image.

Page 55 of 71
Cloud Computing - Azure

Click the Image “Ubuntu-SansWebServer” to select.

Page 56 of 71
Cloud Computing - Azure

In “Image” ensure that your customized / own image “Ubuntu-SansWebServer” has been selected.

Page 57 of 71
Cloud Computing - Azure

Change “VM Size” as “Standard B1s”

Page 58 of 71
Cloud Computing - Azure

In “Administrator Account”

Set “Authentication type” as “Password”.

In “Inbound Port Rules”.

Pubic inbound ports as “Allow selected ports”.

In “Select inbound ports” need to check “SSH” and “HTTP”.

Page 59 of 71
Cloud Computing - Azure

Click “Next : Disks >”.

Page 60 of 71
Cloud Computing - Azure

In “Disks”

In Advanced, you are able to see it have only “managed disks”. You would not be able to change the
captured image disk as unmanaged disk.

Page 61 of 71
Cloud Computing - Azure

Click “Next : Networking >”.

Page 62 of 71
Cloud Computing - Azure

In “Networking”

You have required to ensure the below mentioned options.

Ensure Virtual network as “SANS-VNET”.

Ensure Subnet as “Sans-Pub-Subnet”.

Public IP for Ubuntu-SansWebSvr2

Ensure NSG type as “Basic” and “Public inbound ports” as “Allowed selected ports”.

Ensure “Select inbound ports” as “SSH” and “HTTP”

Page 63 of 71
Cloud Computing - Azure

Click “Next : Management >”.

Page 64 of 71
Cloud Computing - Azure

In “Management”

Click “Next : Guest config >”.

Page 65 of 71
Cloud Computing - Azure

In “Guest Config”

Click “Next : Tags >”.

Page 66 of 71
Cloud Computing - Azure

In “Tags”.

Click “Review + create”.

Page 67 of 71
Cloud Computing - Azure

Click “Create”.

Page 68 of 71
Cloud Computing - Azure

Your “Virtual machine” has been created successfully.

Click “Go to resource”.

Page 69 of 71
Cloud Computing - Azure

Kindly note the public IP address which you have got for “Ubuntu-SansWebSvr2” virtual machine.

Page 70 of 71
Cloud Computing - Azure

Type public IP address in your local machine browser and then press “Enter”.

I have got the customized webpage from captured VM.

We have successfully captured the virtual machine successfully as Image and built new Virtual machine
by using captured image.

When you have deleted the “Resource group” once you have completed the learning purpose lab. Then
Captured Image in Azure has been deleted automatically.

Page 71 of 71

You might also like