02_Create_&_Connect_to_Ubuntu_Server_ed13
02_Create_&_Connect_to_Ubuntu_Server_ed13
[Edition 13]
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
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
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
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.
12
5.1 Connect Using the Password
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
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.
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
• 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”
26
2. Go to the network interface
27
4. Under IP Configuration select Ipconfig
5. Click on IP address
28
8. Click on Save
29
10. Now you can stop the VM without Reserve the IP address.
30
10 TRACK AZURE CREDIT BALANCE
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
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 .
Troubleshooting steps:
Troubleshooting steps:
• Verify that the host name is correct
• If not working properly then use IP instead of host-name
35
5. SUMMARY
36