Unlock the power of Azure Database for MySQL flexible server with our step-by-step guide tailored for nonprofits
After deploying your web app, you would want to access and manage your database in Azure. If you are unsure how to deploy a WebApp in Azure, follow this article: Building a Web App and Database in Azure for Nonprofits | Microsoft Community Hub. This guide provides step-by-step instructions for nonprofits to connect to their Azure MySQL Database.
Step-by-Step Instructions
- Log in to Azure Portal:
- Visit the Azure Portal: https://portal.azure.com/
- Use your credentials to log in.
- Locate Your Database:
- Navigate to Resource Groups and select the group where your database is hosted.
- Click on your Azure SQL Database.
- Navigate to Resource Groups and select the group where your database is hosted.
- Select Networking:
- In the settings, select Networking.
- In the settings, select Networking.
In the image above, the MySQL database is situated within a Virtual Network (VNet). This configuration ensures the database is isolated from the internet, allowing communication solely between resources within the VNet. The most efficient method to access the database is via a virtual machine deployed within the same VNet. Additionally, ensure the virtual machine is deployed in the same region as the MySQL database.
Step-by-Step Guide to Deploying a VM in Azure
- Sign in to Azure Portal:
- Visit the Azure portal and sign in with your Azure account: https://portal.azure.com
- Create a Virtual Machine:
- In the search bar, type "Virtual machines" and select it from the services.
- Click on "Create" and then "Azure virtual machine".
- In the search bar, type "Virtual machines" and select it from the services.
- Configure Instance Details:
- Enter a name for your VM (e.g., myVM).
- Choose the image (Ubuntu Server 24.04)
- Select the size of the VM based on your requirements.
- Set Up Administrator Account:
- Provide a username (e.g., azureuser) and a strong password.
- Provide a username (e.g., azureuser) and a strong password.
- Configure Networking:
- Under "Inbound port rules", select the ports you want to allow. Please allow port ssh (22).
- Under "Inbound port rules", select the ports you want to allow. Please allow port ssh (22).
- Select Networking:
- Under Vnet, ensure that the virtual machine is still on the same Virtual network as the MySQL database.
- Under Vnet, ensure that the virtual machine is still on the same Virtual network as the MySQL database.
- Review and Create:
- Click on "Review + create" to validate your settings.
- Once validation is complete, click "Create".
- Connect to Your VM:
- After deployment, go to the resource and select "Connect" > SSH.
- After deployment, go to the resource and select "Connect" > SSH.
- Connect with ssh using Azure CLI:
- Select configure + connect
- Select configure + connect
- Download and install mysql-client tool to connect to the server. For this example the database is a MySQL database
- sudo apt-get update
- sudo apt-get install mysql-client
- sudo apt-get update
- Connect to the MySQL database
- Go back to the MySQL resource
- Click on reset password if you have forgotten the password.
- Once the password is changed, select connect and select connect from browser or locally.
- Copy the code that was displayed. You can see the example from the picture above.
- Paste the connection code into the virtual machine to establish a connection to the MySQL database. Upon successful connection, a welcome message will be displayed. You can then proceed to use MySQL commands to create and manage your tables.
- Go back to the MySQL resource
Conclusion
By following these steps, nonprofits can securely access and manage their Azure SQL Database. In the next part, we’ll explore how to deploy your web application codes.
Additional Resources
Updated Jun 05, 2025
Version 1.0Brandon_Antoine
Microsoft
Joined April 23, 2024
Nonprofit Techies
Follow this blog board to get notified when there's new activity