Introduction & Overview
Creating an App Service Web App
Creating Web Service Containers
Configuring a Web App
You’ve got an idea for a great web app, or maybe you’ve already started building it. The next question is how are you going to get it out there on the Internet?
In this course, you will learn how you can quickly and easily set up a website and publish your app to the world with Azure App Service. Of course, web apps are a lot more complex and varied than just HTML pages and we will see how App Service supports a range of programming languages, frameworks, and even operating systems. We will explore features that greatly simplify application deployment and management, as well as those that will increase your app’s functionality like authentication and accessing on-premise data. App Service as with other Azure products has a raft of tools for monitoring and logging so you can make sure your app is performing optimally.
For any feedback, queries, or suggestions relating to this course, please contact us at firstname.lastname@example.org.
- Deploy apps using the Azure App Service
- Create a web app using the Azure Portal
- Create a web app using Visual Studio
- Understand the configuration and diagnostic capabilities available from Azure App Service
- Understand the advanced features of the service such as container deployment and deployment slots
This is a beginner level course suited developers or anyone wanting to know how to deploy web apps to the Azure cloud.
To get the most from this course, you should have a basic understanding of the software development lifecycle, while knowing how to code would be a plus.
Course source code
.NET 5.0 demo code
.NET Core 3.1 demo code
Let's start by creating an Azure Container Registry to store our container image. In the portal, create a new container resource of type container registry. This resource creation process is similar to that we have seen already where we assign a resource group, give our registry resource a name, and specify the location. I'll stick with the standard sku; this is similar to service level tier. For this demo, there is nothing to do in the way of networking or encryption, so I will just review and create the resource. I'll just go into the registry, and enable admin access so that our app service will be able to get access to, and pull the image from the container registry.
Creating a docker image from within the Microsoft Azure ecosystem in conjunction with Visual Studio has been made relatively easy. You need to have docker desktop installed on your PC. For a standard Windows installation, you will also need to have hyper-v enabled through Windows features and settings. Once installed, you will have the docker desktop service running as a VM. As far as Visual Studio goes, it is simply a case of enabling docker support and then choosing the container operating system at the time of project creation. Enabling Docker OS allows me to choose between Linux or Windows based images. Here I have a web API application that I prepared earlier that is targeting a Linux docker container. The pickup controller returns three hard-coded JSON records. Now, let's publish the app to the Azure container registry we've just set up.
This is an Azure container registry, not the docker container registry, even though it is a docker container. We see here the specific target is the Azure container registry. When we click next, we are presented with the available container registries based on our subscription. As we have seen in previous app deployments we have the ability to create a new Azure container registry at this point, if one does not already exist. Now, we just click the publish button. This process will take a little while as it is not just the application being built, but the whole docker image is being constructed and then pushed up to our registry. At the bottom of the output window we can see that the image has been successfully pushed with the tag latest. A tag is a text label that you can use to specify a particular docker image when it comes to deployment. This tag defaults to latest. Going back to the portal and looking in repositories, we can see the new image. Drilling into that image, we can see the single instance of latest and its manifest.
Now I need to create the app service that will run my Linux docker image. As before, I'll create a web app, select a resource group, and give it a name. However, this time I'm not going to publish code I'm going to publish a docker container. Because the container is a completely self-sufficient instance of my application, including all the supporting libraries, I don't need to specify a runtime stack. I'll select my region and then change the sku and size to F1-free. Under Docker, we tell the app service where to get the container image from.
Before we publish our container let's pull a public container from docker hub. So, it's a single container, and the image source is Docker Hub. I'll go over to Docker hub and grab the image id and append colon latest as the tag.
Next, review and create the app service. Once the app service is deployed, we can see the container settings which are pretty much the same as we saw when creating the app service. Clicking on the url and going to the apps pickup url we see the JSON result.
Now let's change the container source from docker hub to the Azure container registry image we previously uploaded. In deployment center change the registry source from Docker Hub to Azure Container Registry. Select the appropriate registry from the drop-down. If you forgot to enable access to the registry as we did earlier this is the message you'll get. Next, select the image and then the tag. By the way, the tag can be anything, like version numbers or some text to differentiate container variants. Once we've specified the new image source we can save the deployment and go back to the web page and hit the refresh button. As you might expect re-pulling a container from the registry to the App service for the first time does take a bit longer than if you were updating an app, especially a small trivial one like this. Quite a bit longer it turns out on the free plan. You'll notice I've changed the app slightly to reflect the Azure container source.
Hallam is a software architect with over 20 years experience across a wide range of industries. He began his software career as a Delphi/Interbase disciple but changed his allegiance to Microsoft with its deep and broad ecosystem. While Hallam has designed and crafted custom software utilizing web, mobile and desktop technologies, good quality reliable data is the key to a successful solution. The challenge of quickly turning data into useful information for digestion by humans and machines has led Hallam to specialize in database design and process automation. Showing customers how leverage new technology to change and improve their business processes is one of the key drivers keeping Hallam coming back to the keyboard.