Deploy Azure Web App using Azure SQL Database (PaaS)
This IT Pro Challenge helps learners understand how to create and deploy an Azure web app using an Azure SQL database as the repository for dynamic data. They will learn about Azure App Service deployment slots, how to create a slot, and how to deploy an Azure web app to a production slot and verify the connection.
In this IT Pro Challenge, learners will understand how to work with the Azure App Service to create deployment slots for staging and deploying Azure web apps. Learners will create a web app using an Azure SQL database on a logical server, use deployment slots to deploy the app to production, and test the various configurations after each deployment, ensuring that the add, update, and delete functionality of the database are operational. The skills learned in this virtual lab are important for the role of a network or system administrator.
The scenario for this lab is that you are a system administrator, and your company is migrating its primary web app and database from an on-premise datacenter to Azure. Your job is to use the Azure portal to create and deploy an Azure web app to both staging and production using an Azure SQL database. You need to test the configuration after each deployment to verify the add, update, and delete functionality of the database.
Create an Azure Web App with Azure SQL Database
To begin, you will sign in to the Azure portal and create a web app and an Azure SQL database that uses a new logical SQL server. You will verify the web app is running by navigating to its URL.
A logical server is hosted on a physical server; one physical server can have multiple logical servers. Using logical servers decreases the need for physical servers that are both expensive and take up a lot of real estate. One drawback to logical servers is that if you need to reboot or stop the physical server, all associated logical servers are also affected by the outage.
Deploy application to Staging slot
A deployment slot is an instance of an application with its hostname. Slots are different environments made available through a publicly available endpoint. One slot is always mapped to production, and you can swap other instances to different slots. Slots are beneficial for several reasons. They provide different environments for different application instances before you swap to staging or production. By deploying to a slot, rather than straight to production, you can “warm-up” the app to reduce latency before going live in the production environment. And slots provide an easy fallback method if you swap to a production environment and then need to revert to the previous configuration.
In this part of the lab, you will create a deployment slot (staging), define the connection string for the staging slot, and point the connection string to the Azure SQL database that you created at the beginning of the lab. Then you will verify that the connection string connects to the Azure SQL database.
Deploy the Azure web app to production
Finally, you will swap the slot for the Azure web app and its connection string from staging to production. You will then verify that the database add, update, and delete functionality (the connection string) for the web app works properly in the production environment.
By taking this hands-on lab, you will learn how to use the Azure portal to create an Azure web app that uses an Azure SQL database, create a staging slot for deploying the web app, deploy the web app to production, and verify the database access after each deployment (staging and production).