How to deploy your web app in Windows Containers on Azure App Service | Azure Tips and Tricks

How to deploy your web app in Windows Containers on Azure App Service | Azure Tips and Tricks


>>Learn how to run your application
in a Windows Container on Azure App Service in this episode
of Azure Tips and Tricks. Sometimes you have a
web application that runs on the full .NET framework, and has dependencies to things like a library into Windows
Global Assembly Cache. You can run an
application like that in a Windows Container in an
Azure App Service Web App. Let’s take a look at how that works. Here in Visual Studio, I have an ASP.NET Forms Application that runs on the .NET framework 4.7. Let’s containerize it. I can do that by right-clicking
the project file, and click Add>Docker Support. This adds a Docker file that describes the Container image
that the app will run in. To make this work on your local PC, you need to install Docker Desktop. You can download it
from this address. Also, you need to set Docker
Desktop to run Windows Containers, instead of Linux Containers. Now, I need to publish this
image to a Container Registry. You can use all sorts of registries, and I’ll put it in a new
Azure Container Registry. First, I’ll select a resource
group for the Registry, and give it a name. This is also used in the
URL for the Registry, and I also wants to change the
location to “West Europe”. All right. Let’s create it. This creates the
Container Registry and uploads the Container image
with the application to it. This can take a while, so I’ll skip to when
it’s done. All right. Now that we have a Container
image in the Registry, we can use it to run
the app in Azure. Here in the Azure Portal, I’m going to create a
new app service web app. So in here, I’ll first create a new resource
group for the web app. You can also use an existing one, and I’ll give the web app a
name like this. Alright. Next, I’ll switch this to Docker
image as that is what will run, and it is a Windows container. Okay. I think that’s it. Next, I need to tell it where to
get the Container image from. That is from here, the
Azure Container Registry. Okay. This looks good. Let’s review and create, and let’s create it. Alright. I’ll skip
to when it’s done. This is the web app that
we’ve just created, and I noted it is still starting
up the container right now. You can see what is happening by looking at the container
settings here. Here in the logs, you can see that it downloads the Container image and
extracts it to start it. If any errors happen, you can see them here as well. Alright. Let’s go
back to the overview. This is the URL of the web app. Let’s take a look. It
is still starting up. The Container needs to start up. This can take several
minutes to work when you start the web app
for the first time. So I’ll skip ahead and try again, and here it is, the application running in Azure in
a Windows container. Windows containers that run
in an app service web app provide you with the
benefits of Azure like scaling and deployment slots, while still giving you a lot of
control over your environment. Go and check it out.

Danny Hutson

Leave a Reply

Your email address will not be published. Required fields are marked *