This is part 21 of azure tutorial. In this video, we'll discuss how to deploy a web application,
specifically ASP.NET webforms application in azure. It doesn't really matter if it's Web Forms,
MVC or .NET Core, the process is the same. You'll see, how easy it is. With just a few clicks,
in just a few minutes, you have your app up and running in the cloud. Now, this
is the web application that we will be deploying in azure. As you can see, it displays a list
of inspirational quotes. At the moment, this web application is running on my local machine, you
can say that by looking at the URL in the address bar. This is the web form that displays the list
of quotes. At the moment, as you can see on this web form, we have a repeater and if we take a look
at the code behind file, we have a method here - GetQuotes() and it returns list of strings,
that is in our case, list of quotes. So, we have a variable here of type List and what we are
doing is, adding five quotes to this list and then returning that list and in the page load event, we
are calling that method which is going to return us the list of quotes and setting that as the data
source for the repeater and calling the DataBind() method, and for the repeater itself, we have an
and an . The only difference between these two templates
is, we are using different bootstrap styling classes. For the , we are using
alert-success and for the we're using alert-danger, and that's the reason
we see two different colours here. So, a pretty simple ASP.NET Web Forms application.
In just a bit, we'll see how easy it is to deploy this web application in azure using
azure app service. Now, let's see what it takes to host this same web application
in our own on-premises server. It involves a lot of things. First, we need a physical
or a virtual server. Server operating system like Windows or Linux must be installed. The server
needs to be secured and configured. Install antivirus software, updates and any patches,
configure firewall settings etc. It's another big task for the infrastructure team. It's not just
the initial setup, they have to maintain it too. To host a web application and make it
available on the web, you need a web server like IIS, Tomcat, NGINX etc. You need to install and
configure the web server correctly like security permissions, application pools, SSL settings etc.
The list goes on. On top of this you install your web application and any dependencies it may have.
Just imagine, the number of people, the amount of time and effort it takes to have our app up
and running in our own on-premises server. Now, before we deploy our web application in azure,
let's quickly hop over to the azure portal and let me click on resource groups.
As you can see, we don't have any resource groups. I've deleted everything that we have
in the azure portal to keep our slate clean. We are going to deploy our web application to azure
right from within virtual studio. So, in the solution explorer, right click on your
web application project name and then select this option from the context menu - Publish.
On this "Publish" window select "Azure" and click "Next". Here, select "Azure App Service" because
it is the azure app service we want to deploy our web application to, and then click "Next".
From the drop down list here, select your azure subscription and then we want to deploy our
app to an app service instance in azure. In the azure portal, we deleted everything. So, we don't
have an app service instance already. So, let's create a new app service instance by clicking on
this "+" sign. On this "Create App Service" window, we first need to provide a name for
the app service and the name we provide here is important because it is this name that's going to
determine the URL that we will be using to access our web application. Now, to keep it unique,
I'm going to name it - KudvenkatQuotes. So, the URL to access our web application now will be
KudvenkatQuotes.azurewebsites.net. We'll see that in just a bit. If you want to, you can
use your own custom domain, maybe something like Inspirationalquotes.com. We'll discuss, how to do
that in our upcoming videos. Next, select your subscription from this drop-down list and then
a resource group. We are creating a new resource group here. I'm going to leave the default name
and then a hosting plan. We want to use a free hosting plan to host our web application. We want
to start free and then add features as required. So, to select a free hosting plan, click on this
"new" button. Provide a name for the hosting plan. Let's leave the default name and then a
location. Let's select, East US region. Finally, size. It is the size that determines what we pay
and what we get. The size actually corresponds to azure pricing tiers. In our previous videos
in the series, we discussed in detail - App Service, App Service Plans, Pricing Tiers,
including how to create them in azure portal. The only difference now is, we are creating them
right from within visual studio, while we are deploying the app, but the concept is still the
same. Now, we don't want to pay anything to host our web application. We want to start free. So,
let's select the "free" pricing tier and then click "OK". On this window click "Create".
Right now, our app service and app service plan with the
selected pricing tier are being created in azure.
Finally click - Finish.
We are almost there. At the moment, we are on this "Publish" window, and we can see the summary here.
This is the URL, we use to access our website and this resource group is already created in azure.
It is in this resource group, we have both our app service and app service plan already created. Now,
all that is left to do is deploy this website to this app service in azure. For that to happen,
all we need to do is push this "Publish" button. There we go. We have our code deployed and our app
is up and running in the cloud. Take a look at the URL in the address bar. Now, take a look
at azure portal. We have our Quotes resource group created and if we navigate to it, both
our app service and app service plan are present here and if we navigate to the app service plan,
at the moment we are on the "Overview" blade. Let's go to "Apps".
We see our "KudvenkatQuotes" app deployed in this plan. Let's click on "Scale up".
We have pricing tiers here and if you remember, within visual studio we selected the "free"
pricing tier and that is what is selected by default. If we want more features, for example
something like custom domains or SSL bindings, we select the appropriate pricing tier and then
click - "Apply". For now, let's just stick to this "Free" pricing tier. At the moment, the data
for our web application, in this case, "quotes" data is hard coded within the web page itself,
but what if this data has to come from a database. The point is, how to deploy a web application
that has a dependency on a database like SQL server for example. We'll discuss,
how to do exactly that in our next video. That's it in this video. Thank you for listening.