Provision Relational Databases for a Web App
This IT Pro Challenge lab shows learners how to provision an Azure SQL database and an Azure Database for MySQL, use a data export file, create data structures, and configure a web app to use two different databases. As proof of concept, learners will test their work using a provided web application.
In this IT Pro Challenge, learners will understand how to use the Azure Cloud Shell Command Line Interface (CLI) in Azure Portal to create and configure an Azure SQL database, use a SQL server data export BACPAC file to create an Azure SQL database, define and populate a MySQL database, create data structures, configure connection strings for different databases for a web application, and test their configurations. The skills acquired in this lab are useful for a career as a network or a system administrator.
The scenario for this lab is that you are a system administrator, and your company is migrating its primary web app that uses both SQL Server and MySQL databases from their datacenter to Azure. To do this, you will provision an Azure SQL database from a data export BACPAC file. Then you will provision an Azure Database for MySQL, use the MySQL Command Line Interface (CLI) to create data structures, and configure the web app to use the new databases.
The Azure portal contains Azure Cloud Shell, a shell environment you can access from a browser. By default, Azure Cloud Shell contains the Command-Line Interfaces (CLI), PowerShell (Windows), and Bash (Linux). The Bash Cloud Shell contains the full MySQL CLI.
NOTE: If you use the Bash Cloud Shell, you must first provision a storage account, and then use the advanced option when launching the Bash Cloud Shell to specify the storage account that you created.
Provision an Azure SQL server and import a SQL Server database
To begin the lab, you will sign in to the Azure portal, create (provision) a SQL server logical server, and use a BACPAC file to create a SQL Server database (CorpData). A BACPAC (.bacpac) file is a Windows file containing schema and database data that allows you to move a database from one server to another. Essentially, the BACPAC file contains exported database data that you can then import to another server.
Provision an Azure Database for MySQL server
Azure Database for MySQL Server is a fully managed relational database service powered by the MySQL community edition.
In this step of the lab, you will provision an Azure Database for MySQL server (mysql12521509) and configure the database security to allow access to Azure Services.
Define and populate a MySQL database
Now you will create a database (customerData) on the MySQL Server that you created in the last step (mysql12521509). Then you will add a table (customer) that has two columns (id, name) and populate the table with at least a few rows of test data.
Configure the web app to use the databases
Your last task is to configure two connection strings (CorpDataConnectionString, CustomerDataConnectionString) for the provided web app. The first connection string is for the CorpData SQL server database, and the second is for the customerData MySQL database.
Test the web application
Finally, you will test your work using a provided test page. You will see sample data from both databases that you created and a success message if you set up the two connection strings properly.
By taking this lab, you will learn how to provision an Azure SQL server, use a BACPAC file to import a SQL Server database, provision an Azure Database for MySQL server, create data structures in a MySQL database, configure a web app to use the databases you created, and verify that a web app can access these databases.