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

02_Create_&_Connect_to_Ubuntu_Server_ed13

Uploaded by

dbstudies07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

02_Create_&_Connect_to_Ubuntu_Server_ed13

Uploaded by

dbstudies07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

Create & Connect to

Linux VM (Ubuntu) Machine on


Azure Cloud

[Edition 13]

[Last Update 221120]

1
Contents
1 Introduction .........................................................................................................................................................3
2 Documentation ....................................................................................................................................................5
2.1 Microsoft Documentation ........................................................................................................................................ 5
3 Pre-Requisite .......................................................................................................................................................6
4 Create Virtual Machine On Azure Portal ....................................................................................................7
5 Connect to Ubuntu Server Using Password & SSH Keys ..................................................................... 12
5.1 Connect Using the Password ................................................................................................................................. 13
5.2 Connect Using SSH Keys .......................................................................................................................................... 16
6 Stop OR Terminate Ubuntu Machine ........................................................................................................ 19
7 Reset Virtual Machine Password ............................................................................................................... 21
8 How to open ports in azure .......................................................................................................................... 23
9 How to remove Reserve Ip Option............................................................................................................. 26
10 Track Azure credit balance ...................................................................................................................... 31
11 Troubleshooting Section ........................................................................................................................... 33
11.1 Not able to connect to SSH due to 22 port error ........................................................................................ 33
11.2 Common error while SSH Errors occur while ............................................................................................. 35
11.3 Host-name Resolution ......................................................................................................................................... 35
11.4 Permission denied ................................................................................................................................................ 35
5. Summary ......................................................................................................................................................... 36

2
1 INTRODUCTION

Azure Virtual Machines (VM) is one of several types of on-demand, scalable computing
resources that Azure offers. Typically, you choose a VM when you need more control over the
computing environment than the other choices offer. This article gives you information about
what you should consider before you create a VM, how you create it, and how you manage it.

An Azure VM gives you the flexibility of virtualization without having to buy and maintain the
physical hardware that runs it. However, you still need to maintain the VM by performing tasks,
such as configuring, patching, and installing the software that runs on it.

3
Azure virtual machines can be used in various ways. Some examples are:

• Development and test – Azure VMs offer a quick and easy way to create a computer with
specific configurations required to code and test an application.
• Applications in the cloud – Because demand for your application can fluctuate, it might make
economic sense to run it on a VM in Azure. You pay for extra VMs when you need them and
shut them down when you don’t.
• Extended datacenter – Virtual machines in an Azure virtual network can easily be connected
to your organization’s network.
• The number of VMs that your application uses can scale up and out to whatever is required to
meet your needs.

Note: Stop The Virtual Machine if you are not using the machine.

4
2 DOCUMENTATION

2.1 Microsoft Documentation

1. Create a Virtual Machine using Azure Portal


https://docs.microsoft.com/en-us/azure/virtual-machines/windows/quick-create-portal

5
3 PRE-REQUISITE
Ensure that you have an account (Trail or Paid) in Azure Cloud.
Note: Follow Activity Guide Register_For_Azure_Cloud_Account_Accessing_Console_ed**
from portal

6
4 CREATE VIRTUAL MACHINE ON AZURE PORTAL

1. In the Azure portal, search for Virtual Machine and select Virtual Machine.

Make sure you have an active subscription before doing all this. If you created a free
account for the first time, you’ll already have a FREE TRIAL subscription for 1 month.

7
2. Click on Create then select Azure VM

3. Enter the following values:

• Subscription: Select your Azure subscription


• Resource group: Enter a new resource group name (Note: If this is first time you are
creating any resource then select Create New to create a new resource group)
• Virtual Machine name: It should be a unique name throughtout the Azure network.
• Region: Select an Azure location, such as Western India, Central US etc.

8
9
Optional: Using SSH Key pair in place of username/password to connect to Ubuntu machine

Another way to connect to machine is using SSH key pair and if you prefer SSH Key pair then

select this option

10
Note: Stop The Virtual Machine if you are not using the machine.

11
5 CONNECT TO UBUNTU SERVER USING PASSWORD & SSH KEYS

There are two ways to connect to machine Using SSH and using Password.

After you create a Virtual Machine, click on the newly created Virtual Machine. Click on Connect.

Now a dialogue box will open.

12
5.1 Connect Using the Password

1. Open putty.exe in your system


1. Enter the following
Host Name (or IP Address): Enter Public IP of your instance
Port: Enter 22
Connection type: Select SSH

13
2. Enter the following
Login id: AzureUser
Password: your Password

14
Note: Stop The Virtual Machine if you are not using the machine.

15
5.2 Connect Using SSH Keys

2. Open putty.exe in your system


3. Enter the following
Host Name (or IP Address): Enter username@Public IP [email protected]
your instance
Port: Enter 22
Connection type: Select SSH

16
4. Now, expand SSH and select auth and Browse your Private key and click open

17
5. Now, it will display the below message, then click on Yes

6. Once these steps done, Now you are successfully connected to your instance.

Note: Stop The Virtual Machine if you are not using the machine.

18
6 STOP OR TERMINATE UBUNTU MACHINE
1. Go to the Machine Overview page

2.Click on Stop to stop the machine then click on Ok to stope the machine.

3. Status will change to Stop now click on Start to start machine.

19
4. To Terminate the machine click on Delete

Note: Stop The Virtual Machine if you are not using the machine.

20
7 RESET VIRTUAL MACHINE PASSWORD
1. Select Virtual Machine and goto the Support+Troubleshooting-> Reset Password

2. Under Mode Enter Username & New Password

• Username: DockerMachine
• Password: Enter your password
• Confirm Password: Confirm Enter your password
• Click on Update

21
22
8 HOW TO OPEN PORTS IN AZURE
1. Reach the home page of Azure and select Virtual Machines and click on your VM and then
click on Networking.

2. By opening networking section, you will see this on your screen and also a button called Add
inbound port rule, click on that and you will see an Add inboubd security rule window.

23
3. Change the Destination port ranges from 8080 to * and also the Name from Port_8080 to
All_Ports and click on Add.

Note: For poc purposes we are opening all the ports in Azure cloud.
24
4. On successful creation you will see the new All_Ports in the list of Inbound port rules like in
the below image.

25
9 HOW TO REMOVE RESERVE IP OPTION
If you Accidently Saved IP while Stopping a virtual machine then next time you will not get the
option for “reserve the Public IP”.

Next we will not get the option for “Reserve public IP address”

1. Goto Networking in Menu

26
2. Go to the network interface

3. Under Network Inerface click on IP Configurations

27
4. Under IP Configuration select Ipconfig

5. Click on IP address

6. Click on Create new

7. Under create IP:


• Name: New_1
• SKU: Select Basic
• Assignemt: Dynamic
• Click Ok

28
8. Click on Save

9. Go to the Overview page click on STOP Virtual machine

29
10. Now you can stop the VM without Reserve the IP address.

30
10 TRACK AZURE CREDIT BALANCE

1. Sign in to the Azure portal.


2. Search for Cost Management + Billing.

3. In the billing scopes page, select the billing account for which you want to track the credit
balance. The billing account should be of type Microsoft Customer Agreement.

Note: Azure portal remembers the last billing scope that you access and displays the
scope the next time you come to Cost Management + Billing page. You won't see the
billing scopes page if you have visited Cost Management + Billing earlier. If so, check that
you are in the right scope. If not, switch the scope to select the billing account for a
Microsoft Customer Agreement.

31
4. Select Payment methods from the left-hand side and then select Azure credits.

32
11 TROUBLESHOOTING SECTION

11.1 Not able to connect to SSH


due to 22 port error
Issue: Sometime we may face this kind of issue if we haven’t selected the 22 port mentioned in the screenshot

Fix: Try the following to resolve this issue:


1. Add an inbound network security group rule with destination port 22.

33
2. Select option on services as SSH and then click on “add”

3. A security rule will get created and then you can connect to SSH

34
4. Issue resolved .

11.2 Common error while SSH


Errors occur while
Cause: Connection Refused
This will occur when the server which is supposed to listen to the request, stops listening

Troubleshooting steps:

• Verify that the host IP address is correct


• Verify the firewall rules, check the inbound rules allowed by the security group.
• Verify the port number allowed for ssh
• Verify that the service is running properly

11.3 Host-name Resolution


Cause: It happens when the reference to the SSH host can’t be mapped to a
network address.

Troubleshooting steps:
• Verify that the host name is correct
• If not working properly then use IP instead of host-name

11.4 Permission denied


It happens when the user is not authorized to logging into the server. It is mainly
due to the sshd_config file that contains SSH server configuration.

35
5. SUMMARY

In this activity Guide we learned:


• How to create a Virtual Machine on Azure Portal.
• How to Connect to Virtual Machine Using Putty.
• How to Update VM Password.
• How to Open ports on Azure Cloud.
• How To Remove Reserve IP Option
• Track zure credit balance

36

You might also like