How to Deploy Applications on Azure Cloud: Step-by-Step Guide

NitinNitin
5 min read

Heads up: This is the second article in the series 'Deploy Your App on Azure Without Spending a Dime'. If you haven't checked out the first article yet, you can find it here.

Prepare Our App to Publish to Azure

  • Open the app in VS Code.

  • Open the terminal in VS Code and run the dotnet publish -o publish command.

Terminal in VS Code

Let's check if a ‘publish’ folder is created in our app folder opened in VS Code.

Publish Folder

Create VM on Azure

You can either create a VM by searching for "Virtual machine" in the search bar OR click on the Virtual Machine option shown on the Home page of the Azure portal.

Azure Portal

You will land on a page as shown below.

Azure VM Page

Click on the Create option and select ‘Azure Virtual Machine’ from the list.

Create a new ‘Resource group’.

Resource Group

Choose the region and other required details.

Region Selection

I chose the nearest region from my location and required other details that are enough for my app on Azure.

Select the size for VM – to do that, click on the ‘See all sizes’ hyperlink.

VM Sizes

Refer to the different options and their prices.

VM Pricing

I am going to choose B2ms as these kinds of machines will not be up 24*7 but used periodically and are suitable for my case. Also, note the price for it.

B2ms Selection

Select the item in the list and click the ‘Select’ button.

Enter admin and password details, and make sure the port is RDP.

Admin Details

Click Next to configure the disk.

Configure Disk

Reasons to select SSD:

  1. It fits the requirement.

  2. It’s cheaper in price than premium.

Select and click ‘Next’ to configure network settings.

In the virtual network, Azure will generate names automatically for the IP and network, but we can rename them to what we want.

Network Settings

I want to keep the IP static, so I can use it always to connect and while configuring the load balancer in steps further.

Static IP

Click on OK for the Create IP address pane and click on the Review + Create button.

And I got successful validation on the 2nd try. As in the first, it gave me an error but without changing anything – I clicked on the Review + Create button after 2 minutes – GOT SUCCESS.

Successful Validation

Click on the ‘Create’ button as the final step towards creating the VM.

Create VM

Let's wait for Azure to deploy the VM.

Deploy VM

NOW – let's connect to it and configure it to run the Catalog app.

Click on ‘Go to resource’.

Let's review if it has all as configured.

Review Configuration

Click on the ‘Connect’ icon as highlighted in the screenshot above and select ‘Connect’ from the dropdown that would display.

Click on the ‘Select’ button on the ‘Native RDP’ displayed and click on the ‘Download RDP file’ button.
(RDP is Remote Desktop Protocol.)

Download RDP

Download and double-click on the file.

You should see a window like the below screenshot.

RDP Connection

Click ‘Connect’.

It will ask to enter the credentials – enter the details you set while configuring the VM.

Click on ‘Yes’ to connect to the remote desktop.

Remote Desktop Connection

The following screen will be displayed.

Remote Desktop Screen

NOW let's configure by going through step-by-step as shown in the image below.

Click on ‘Add roles and features’.

Add Roles

Click ‘Next’.

Add Roles Next

Click ‘Next’.

Select the VM to make it a server – as of now I have only one and I will use the same for the purpose.

Select VM

Click ‘Next’.

Select the highlighted option to add the respective role and features.

Select Features

Click on ‘Add Features’.

Add Features

Click ‘Next’.

No changes required as of now.

Next

Click ‘Next’.

Click ‘Next’.

For Role Services – select ‘Custom Logging’ and ‘Logging Tools’.

Role Services

Click ‘Next’.

Click on ‘Install’.

Install

Let the installation complete.

Installation Progress

Installation is complete, click ‘Close’.

Installation Complete

The dashboard post-installation.

Dashboard

Now, Edge would have automatically opened for you – continue without syncing data and type ‘localhost’ and hit enter.

Localhost

So – the localhost is working for me; this means the machine is successfully configured as a web server.

NOW let's install the hosting bundle 'dot net 6' which is required for my app to run on this server.

Download from https://dotnet.microsoft.com/en-us/download/dotnet/6.0 > SDK > relevant SDK installer > download and install.

Dotnet Download

Dotnet Installation

Installation successfully completed.

Installation Success

The web server is ready to host my app.

Let's go to the C drive to create the folder for app files.

C Drive

Let's go back to the local computer and open the ‘publish’ folder from the app folder. Copy all of the contents of the ‘publish’ folder.

Publish Folder

AND paste them under the ‘catalog' folder on the remote machine.

Copy is complete on the remote machine.

Remote Machine

Let's go to the Windows search bar, type IIS, and open the only option that appears in the search results.

IIS Search

Results as below:

IIS Results

I have to create a website for the catalog app. Expand the ‘catalog-vm’ option and click on the ‘Add Website’ option.

Add Website

  • Enter the site name.

  • Select the ‘catalog’ folder from the file storage of the remote machine.

  • Enter the port ‘8080’.

Website Details

And click ‘Ok’.

Click on the URL highlighted in the screenshot below to open the app on localhost.

Open App

GREAT – the app is now opened on the remote machine as well.

App Opened

Functioning as expected.

App Functioning

A QUICK IMPORTANT REMINDER – ALWAYS SHUT DOWN THE VM WHEN NOT IN USE

Shutdown VM

Hope this helps you.

0
Subscribe to my newsletter

Read articles from Nitin directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Nitin
Nitin

A Seasoned gate keeper for software quality (Manual / Automation (Web + Mobile native + API) / Performance test) with 13 years of experience, An automation🤖 lover and a continuous📚 learner. A test automation geek and a DevOps engineer using and exploring cloud☁️. Looking for opportunities in Cloud DevOps for mutual growth. (Working remotely since last 5 years with teams in Europe / USA and Canada)