The purpose of this page is to show how you can use a mysql server in azure with free tier for a Laravel Project. I was following this Microsoft Tutorial to run a Laravel Project with Github Actions and I needed to create an Azure Mysql Flexible MYSql Server.

  1. Create a free azure account. Usually you will get $200 for 30 days. you can also use the free tier.
  2. Create a Database for MySQL - Flexible Server. Follow this tutorial if needed
  3. Clone Repo: git clone https://github.com/Azure-Samples/laravel-tasks.git
  4. Follow these settings as a template I made because it worked.
Product details
Azure Database for MySQL by Microsoft

Basics
Subscription: Azure subscription 1
Resource group: freetrial-rg
Server name: mysqlserver-EXAMPLE
Administrator login: adminEXAMPLE
Password: WHATEVERYOUWANT
Location: West US 3
Availability zone: No preference
High availability: Not enabled
MySQL version: 8.0
Compute + storage: Burstable, B1ms, 1 vCores, 2 GiB RAM, 20 storage, Auto scale IOPS
Backup retention period (in days): 7 day(s)
Storage autogrow: Enabled
Geo-redundancy: Not enabled
Zonal Resiliency: No

Networking
Connectivity method: Public access (allowed IP addresses) and Private endpoint
Allow public access to this resource through the internet using a public IP address: Yes
Allow public access from any Azure service within Azure to this server: Yes

Firewall rules
SSL/TLS: SSL is enforced and TLS version is 1.2. This can be changed after server is created. Learn more

Additional configuration
Data encryption: Service-managed key
Server Parameter - lower_case_table_names: 1

Tags

Note some important facts. Be sure to create firewall rules in the network tab to allow your ip address

Download the DigiCertGlobalRootG2.crt.pem CA Certificate from Settings > Networking

5. Once the deployment has been completed you can try to connect. You have verious options. I can use Oracle Workbench to test your connection

6. Configure your .env file as such as this:

DB_CONNECTION=mysql
DB_HOST=mysqlserver-EXAMPLE.mysql.database.azure.com
DB_PORT=3306
DB_DATABASE=databaseEXAMPLE [You can create this from Settings > Databases]
DB_USERNAME=adminEXAMPLE
DB_PASSWORD=WHATEVERYOUWANT
DB_SSL_MODE=VERIFY_IDENTITY
MYSQL_ATTR_SSL_CA=DigiCertGlobalRootG2.crt.pem

Resource: I found this Youtube Channel very important for information about Azure MYSQL Server. They have monthly webminar recording 

Done