Microsoft Azure Cloud Shell Startup And Creating A Linux VM WebServer Using Cloud Shell

Microsoft Azure Cloud Shell is very interactive, easy, and browser-accessible Shell platform for creating, maintaining, and managing all Azure resources using portal only. Azure Cloud Shell provides you access to Azure CLI browser-based experience which supports built in tasks. Microsoft Azure Cloud Shell comes with pre-installed command line tools and languages support, so you can work very fast and easily.

In Cloud Shell, Linux Shell Interpreter like Bash and sh is integrated, Azure tools like Azure CLI 2.0 and 1.0 AzCopy integrated, also text editors like vim, nano, and emacs are integrated, source control git is also integrated. In Microsoft Azure Cloud Shell, make, maven, npm and pip is integrated.
Microsoft Azure Cloud Shell supports .NET, GO, Java, Node.js and Python. Microsoft Azure Cloud Shell state session is temporary and gets inactive after 10 minutes if you are not working on it. And Azure Cloud Shell only supports latest versions of browsers like Edge, IE, Chrome, Firefox, and Apple Safari. Also, make sure when you are copying and pasting with Cloud Shell "Control + C" and "Control + V" will not work; instead of that, use control + Insert and Shift + Insert to copy and paste. And only for some browsers, right click on pane and copy paste options are available in Cloud Shell.

Let's start working with Cloud Shell in Azure portal. For that, open and click on Cloud Shell icon available near notification bar, shown in below snap.

Microsoft Azure

When you click on Cloud Shell icon at top, Microsoft Azure Cloud Shell will ask you to select your subscription in which you would like to work on and also, it asks you to create storage account (LRS) in which it will create one File Share of approximately 5 TB. This File Share will be available and mounted as clouddrive under our Home Directory. After selection of subscription and creation of storage account, the Cloud Shell screen available within your portal will be like the below snap.

Microsoft Azure

After this, let's create resource group in Azure using Cloud Shell. For that, type the following command. But before that, type az to use Azure CLI 2.0.

Microsoft Azure

Now, to create Resource Group in Southeast Asia data center, enter the following command in Azure Cloud Shell. And you will find the provisioning state succeeded.

Microsoft Azure

In Azure Cloud Shell, now we are going to create Ubuntu VM in the same resource group which we created in previous step. So, enter the following command in Shell.

az vm create --resource-group myrg --name myubuntuvm --image UbuntuLTS --generate-ssh-keys

Microsoft Azure

The Ubuntu Virtual Machine has been created successfully in Azure.  Please note down this public IP for accessing this Virtual Machine using SSH.

Before that, we need to add inbound security rule to allow the access of port number 80. Here, enter the following command to allow port 80 in Ubuntu VM.

az vm open-port --port 80 --resource-group myrg --name myubuntuvm

After adding port 80 in NSG of VM, we are accessing that VM using SSH in Azure Cloud Shell. Enter the following command.


Microsoft Azure

After that, become the super user of that VM and type the following command.

  • sudo su
  • apt-get update (To Update packages of Ubuntu)

After that, install NGINX using the following command.

  • apt-get install nginx

After this installation, you can copy that public IP of Virtual Machine and try to access on Browser. You will find the below welcome page of nginx.

Microsoft Azure

Recommended Free Ebook
Similar Articles