Deploying an Application on azure using App service

NitinNitin
6 min read

Heads up: This is the 4th 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.
*******************************************************************************
There is one component of Catalog app to manage inventory – its inventory app

I have the code on my local which I run locally successfully.

The steps are so similar as mentioned in my first post for catalog app of this series.

As of now there is nothing in it to reflect as I am not connected to any real database BUT in this post I will share how I deployed it on Azure using App Service and make it fully functional.

  • Creating an app service

On azure dashboard home page, searched for ‘app service’

Selected ‘App Services’ from the result list appeared

Landed on the App Services page

Clicked on ‘+’ on top left and selected ‘Web App’

Landed on Steps to create ‘Web App’ app service.

Kept the ‘Subscription’ value as it is.

For Resource group, selected RG, I had created for ‘Catalog App’ naming ‘readit-app-rg’

The next is ‘Name’. This must be unique across azure app service.

Also, I am going to publish code; hence the value for ‘Publish’ is selected as ‘Code’.

The code I would be publishing requires ‘.Net 6 (LTS)’ as Runtime stack.

For underlying OS selected as ‘Windows’ as it has best support for .Net

And selected the nearest region to deploy the service.

There are 2 components, while deploying app service:

  1. The App Service – is the piece of code that we deploy to azure.

  2. The App Service Plan – is basically an underlying infrastructure that will run the app service code.

The App service plan in short is the fully managed VM that has few actions any user can perform with.

I explored the pricing plans and chosen the most suitable for my requirement.

Clicked on ‘Review + Create’

Clicked on ‘Create’

It took some time in creating.

Faced an Error while deploying – let me look into this and try deploying again.

Updated ‘Region’ to deploy app service as it was suggested in error above.
I tried deploying it to alternate nearer region but there was error on scale set option availability; hence selected possible other region from my country. Tried creating the app service.

The deployment is completed successfully.

The configuration is same that I

Clicked on the ‘Go to resource’ to confirm to see if configuration is as had selected.

It created domain to access the App Service.

App service Plan is also ‘S1’ as it was asked.

Let me try IF APP SERVICE IS RUNNING?

Clicked on ‘Default domain’ value to validate it.

I see its running and it showing a place holder that is waiting for my code to be deployed.

I will now try ‘how this fully managed service’ works?
I went to my VS code where the ‘Inventory’ code is open and was built.

Right clicked on ‘Explorer’ pane.

And clicked on ‘Deploy to Web App’ option.

NOTE – This option is available to me as I had installed ‘Azure’ extension to my VSCode as mentioned in BLOG #1 if the series <Insert the link of the blog and series>

It asked me to ‘Sign in to Azure’

Clicked and confirmed to proceed on alert shown.

It then navigated me on browser to authenticate.

Signed in Successfully.

Asked me to sign in to directory

Selected the same and it poped up the value it fetched from Azure regarding my account subscription

Clicked on it and I was asked permission regarding my resources.

Allowed.

And it navigated me to authorize resource page on browser.

Clicked on the account it shown.

There is a process here, it shares and ask to verify authorization code on your mentioned email id to complete authorization process.

The process is complete.

My VSCode is now asking me to select my resource group.

Selected the only option it is showing.

Confirmed my deployment. Clicked on ‘Deploy’.

And it started deploying ‘Inventory app’ deployment from VSCode.

Deployment is complete and the relative option shown to me.

Clicked on ‘Browse website’

And I can see the website is up and running on the ‘app service’ url.

Achievement/s:

  • Setting up the app service on Azure

  • Deploying the app to app service to Azure from local VSCode.

Something important to note.

I could get the json for the ‘app service’ I created which can be used in case I want to create it respectively through automated steps e.g. IAAC (Infra structure as a code)

  • App Service Features (not limited to)
  1. App Service Editor

  2. Console

  3. Metrics

  4. Scale out

  5. Outbound IP addresses

  6. Deployment Slots

App Service Editor

Clicked on the option for ‘App Service Editor’

Clicked on ‘Open Editor’ url

It opened all files in Editor on Azure

Its all same as it was on my local.

Clicked on one to review.

I can work on my files here itself and quickly deploy to my website in faster way.

Console

Clicked on ‘Console’

It opened me a CMD on windows VM as like we do on our local windows machine.

I can work on my code over app service using console as well.

It listed me all files I have deployed to ‘App Service’

Metrics

Scale out

I can set instance counts

Tried changing to ‘Rule Based’

Clicked on ‘Manage rules based scaling’

I can set maximum instance count though manual scaling.

Tried ‘Custom autoscale’ but its not part of the subscription I have. Could not proceed in.

As part of scaling, I can see ‘run history’, which shows the traffic the app is getting in certain period of time.

JSON that I can use in case I opt for automated Infrastructure creation e.g. IAAC

Notify – I can enable notification regarding auto scaling. This is not enabled in case of Manual Scaling.

And the ‘Diagnostic settings’; which is also enabled only for auto scaling.

Outbound IP addresses:

It lists the outbound IP addresses that can be used in setting up a firewall for my another resource that can only be accessed through my app service.

Deployment slots – This is a bit important hence need another write-up.

********************************************************************************

IMPORTANT NOTE:
I recommended to shut down the VM when not in use.

With App Service, this is not the case. While you can stop an App Service (using the Stop button at the top of the Overview page), all it will do is to stop the functionality of the App Service, but you'll still pay for it.

That's an important difference between App Service and a VM.

With VM - you pay only when the VM is On.

With App Service - The only way to stop paying for it is to completely delete it.

This is another difference between VM and App Service you should keep in mind.

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)