Getting Started with Azure Web Apps and ASP.NET Core
Lab
Beginner
1 h 20 m
2020-05-20
Lab Overview
In this lab, you will create an Azure Web App in the portal and add a staging slot. Then, using Visual Studio you will create a .Net application. You will read environmental variables from a file, then remove the dependency on that file with application settings in Azure. You will view default logs using log streaming in Azure and then create custom log messages in the application. You will explore slot deployment by deploying these changes to Stage and then swapping them to Production.

Related Learning Path(s):
AZ - 204 Azure Developer
Objectives
  • Understand App Services in Azure
  • Understand Slot deployment strategy
  • Understand Log Stream in App Services
Exercises
In this exercise you will create a web application in Azure and add a slot for deployments. App services can be created in the portal as we will do here, or by using the command line, Azure Resource Manager (ARM) templates, or tools in Visual Studio. We use the Azure Portal here to better visualize your options when creating an App Service.
In this exercise, you will create a .Net Core MVC web application and use a slot deploy strategy. You will modify the application to use environmental variables to illustrate the differences between each slot. At the end of this exercise you will have the application deployed to both slots with slight changes to illustrate that they are different instances of the same application.
Keeping environmental values in a config file is generally not a recommended practice in a production workflow. Azure has several ways to keep values and secrets outside of source control. In this section we will use App Settings in App Services to store our environmental values. If these were secrets we would use something like Key Vault or a third party secret keeper.
In this exercise you will add custom logging to the application and publish to slot settings and view your custom logs in log stream. Custom logging can help debug applications that are running in production and even report out messages that may help troubleshoot tasks like data ingestion, where your application is working as expected, but you are having issues that you cannot discover without running a production workflow and viewing the logs.
Real-Time Lab
Not Registered?
Create Account
Already Registered?
Login
What are Labs?

Labs provide a live environment to get hands-on experience using the same tools and services in the real world.


Learn More