Introduction & Overview
Creating an App Service Web App
Creating Web Service Containers
Configuring a Web App
The course is part of these learning pathsSee 2 more
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
Visual 2019 with .NET Core 3.1 was used for the demonstrations in this course.
Let's now deploy a web app from the Visual Studio IDE. This will be a very simple web API connected to an Azure SQL database using Entity Framework to return a JSON response. Before deploying the app, I'll need to create an Azure SQL database, which I'll quickly do through the portal. From my app service, I'll go to the resource group and add another resource. I'll search and select Azure SQL, then click create, then choose single database. Unfortunately, the portal hasn't remembered which resource group I have come from, so I still need to select the resource group. Next, I'll create a new database server entering an admin username and password, click OK and give the database a name. As this is a demo, I'll select the cheapest and lowest spec database service tier through the configure database link. We won't need to set up any endpoints as we will be connecting from our app service, which is another Azure resource. I'll go with the default additional settings, no tags, and then hit the create button. Once the database has been set up, we need to go into Set server firewall and allow Azure service and resources to access this server. While I'm in here, I'll create a firewall rule using the displayed client IP address so I can access the database from my local computer using SQL Server Management Studio. With the database now up and running, we need to create a table. This will be a vehicle table to hold basic make and model information.
There are several ways you can deploy a web app to an app service. You can do it by downloading the publish profile, which contains URLs, usernames, and passwords for web deploy and FTP. Back in Visual Studio, I'll right-click on the web app project and select publish. As you can see, there are a few targets you can publish the app to, but I'm going to import the profile I just downloaded. The profile has the site URL but knows nothing of the database connection except that there is one based on the local app settings file. Next, I'll configure the database connection string. Based on my subscription, I can select a currently active database. If I didn't have a database already setup, I could create one here. I'll specify the database username and password and click next. I don't have a secrets store configured, so I'll uncheck that. Before I can publish, I need to tell Visual Studio that I want to use the database connection string I've just set up in the publish profile as opposed to one that is already configured in the Azure portal – especially as there isn't one there. I'll do that by editing the profile and under database check User this connection string at runtime. Now, let's publish. Switching over to the browser, let's have a look at the result. As there is no home page with the web API, I'll put in the path to the vehicle controller, and we get an empty dataset. But if I insert a record into the vehicle's table, it does return the correct data. Before we move on, I'll quickly show you publishing without the publish profile. It's a similar process except you select Azure and then Azure App Service, and based on your subscription and resource groups; you can then select from current app service resources. If you haven't already created your app service, you can create one from here. From this point on, it's the same process to deploy the app.
This is all reasonably convenient, but in reality, it's likely that the database connection that you are using in your development IDE will not be the same as that in your deployed app. Within configuration, under settings, you can create a connection string that points to another database. You just need to make sure that the name of the connection string matches the one that your app is expecting. We will be looking at deployment slots later on in the course. After clicking OK, don't forget to save. If I export the publish settings now, we can see the new connection string. I'll just refresh the browser. Now I can see data from a different database.
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.