Skip to content

Commit 06ac7af

Browse files
update database name
1 parent 24558f9 commit 06ac7af

11 files changed

Lines changed: 22 additions & 22 deletions

File tree

samples/web-app-mysql-flexible-server/python/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Azure Web App with Azure Database for MySQL flexible server
22

3-
This sample demonstrates a Python Flask single-page web application called *Vacation Planner* hosted on an [Azure Web App](https://learn.microsoft.com/en-us/azure/app-service/overview). The app runs on an Azure App Service Plan and stores activity data in the `activities` table of the `PlannerDB` database on an [Azure Database for MySQL flexible server](https://learn.microsoft.com/en-us/azure/mysql/flexible-server/overview). The server is reached through a [Private Endpoint](https://learn.microsoft.com/azure/private-link/private-endpoint-overview) (group `mysqlServer`) with the `privatelink.mysql.database.azure.com` Private DNS Zone, while a permissive server-level firewall rule lets the deploy machine run the post-create mysql bootstrap that creates the application user and seeds the schema.
3+
This sample demonstrates a Python Flask single-page web application called *Vacation Planner* hosted on an [Azure Web App](https://learn.microsoft.com/en-us/azure/app-service/overview). The app runs on an Azure App Service Plan and stores activity data in the `activities` table of the `plannerdb` database on an [Azure Database for MySQL flexible server](https://learn.microsoft.com/en-us/azure/mysql/flexible-server/overview). The server is reached through a [Private Endpoint](https://learn.microsoft.com/azure/private-link/private-endpoint-overview) (group `mysqlServer`) with the `privatelink.mysql.database.azure.com` Private DNS Zone, while a permissive server-level firewall rule lets the deploy machine run the post-create mysql bootstrap that creates the application user and seeds the schema.
44

55
## Architecture
66

@@ -14,7 +14,7 @@ flowchart LR
1414
nat["NAT Gateway"]
1515
dns["Private DNS Zone<br/>privatelink.mysql.database.azure.com"]
1616
asp["App Service Plan<br/>S1 · Linux"]
17-
mysql[("MySQL Flexible Server<br/>8.0.21 · Burstable B1ms<br/>DB: PlannerDB")]
17+
mysql[("MySQL Flexible Server<br/>8.0.21 · Burstable B1ms<br/>DB: plannerdb")]
1818
1919
subgraph vnet["Virtual Network 10.0.0.0/8"]
2020
direction TB
@@ -49,13 +49,13 @@ The web app enables users to plan and manage vacation activities; all data is pe
4949
5. [Azure NAT Gateway](https://learn.microsoft.com/azure/nat-gateway/nat-overview): Deterministic outbound connectivity for both subnets.
5050
6. [Azure Network Security Group](https://learn.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview): One NSG per subnet.
5151
7. [Azure Log Analytics Workspace](https://learn.microsoft.com/azure/azure-monitor/logs/log-analytics-overview): Centralizes diagnostic logs and metrics.
52-
8. [Azure Database for MySQL flexible server](https://learn.microsoft.com/en-us/azure/mysql/flexible-server/overview): Public-access server hosting the `PlannerDB` database. Burstable `Standard_B1ms`, version 8.0.21, 32 GiB storage, 7-day backup retention, HA disabled. A permissive firewall rule (`0.0.0.0–255.255.255.255`) is created so the deploy machine can run the post-create mysql bootstrap; the Web App itself reaches the server through the Private Endpoint.
53-
9. [MySQL database](https://learn.microsoft.com/en-us/azure/mysql/flexible-server/how-to-create-manage-databases) `PlannerDB`: Created at provisioning time; the post-deploy mysql step creates the `activities` table and seeds the demo rows.
52+
8. [Azure Database for MySQL flexible server](https://learn.microsoft.com/en-us/azure/mysql/flexible-server/overview): Public-access server hosting the `plannerdb` database. Burstable `Standard_B1ms`, version 8.0.21, 32 GiB storage, 7-day backup retention, HA disabled. A permissive firewall rule (`0.0.0.0–255.255.255.255`) is created so the deploy machine can run the post-create mysql bootstrap; the Web App itself reaches the server through the Private Endpoint.
53+
9. [MySQL database](https://learn.microsoft.com/en-us/azure/mysql/flexible-server/how-to-create-manage-databases) `plannerdb`: Created at provisioning time; the post-deploy mysql step creates the `activities` table and seeds the demo rows.
5454
10. [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans): The underlying compute tier that hosts the web application.
5555
11. [Azure Web App](https://learn.microsoft.com/en-us/azure/app-service/overview): Runs the Python Flask *Vacation Planner* app with regional VNet integration into *app-subnet*. The Web App connects to MySQL using a dedicated application user (`testuser`) — the server-admin login is never used at runtime.
5656
12. [App Service Source Control](https://learn.microsoft.com/en-us/rest/api/appservice/web-apps/create-or-update-source-control?view=rest-appservice-2024-11-01): *(Optional)* Configures continuous deployment from a public GitHub repository.
5757

58-
The deploy scripts follow the same pattern as the sibling [`web-app-postgresql-flexible-server`](../../web-app-postgresql-flexible-server/python/) sample: after provisioning, they (i) connect as the server admin via the public endpoint + firewall rule, (ii) create the application user `testuser` with its own password, (iii) grant privileges on `PlannerDB`, (iv) create the `activities` table, (v) seed sample rows, and (vi) write `MYSQL_USER=testuser` + `MYSQL_PASSWORD` onto the Web App's app settings. The server-admin login is never written into the Web App's runtime configuration.
58+
The deploy scripts follow the same pattern as the sibling [`web-app-postgresql-flexible-server`](../../web-app-postgresql-flexible-server/python/) sample: after provisioning, they (i) connect as the server admin via the public endpoint + firewall rule, (ii) create the application user `testuser` with its own password, (iii) grant privileges on `plannerdb`, (iv) create the `activities` table, (v) seed sample rows, and (vi) write `MYSQL_USER=testuser` + `MYSQL_PASSWORD` onto the Web App's app settings. The server-admin login is never written into the Web App's runtime configuration.
5959

6060
## Prerequisites
6161

@@ -117,14 +117,14 @@ You can use [MySQL Workbench](https://www.mysql.com/products/workbench/) to expl
117117
| -------- | ------------------------------------------------------------------------------ |
118118
| Host | `localhost` |
119119
| Port | (see `docker ps` for the host-mapped port of the backing `mysql:8` container) |
120-
| Database | `PlannerDB` |
120+
| Database | `plannerdb` |
121121
| Username | `testuser` *(or `myadmin` for admin operations)* |
122122
| Password | `TestP@ssw0rd123` *(or `P@ssw0rd1234!` for the admin)* |
123123

124124
Or use the [`mysql`](https://dev.mysql.com/doc/refman/8.0/en/mysql.html) command-line client:
125125

126126
```bash
127-
MYSQL_PWD='TestP@ssw0rd123' mysql -h localhost -P <port> -u testuser PlannerDB
127+
MYSQL_PWD='TestP@ssw0rd123' mysql -h localhost -P <port> -u testuser plannerdb
128128
mysql> SELECT id, username, activity, created_at FROM activities;
129129
```
130130

samples/web-app-mysql-flexible-server/python/bicep/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The [`deploy.sh`](deploy.sh) script creates the resource group while the Bicep m
2929
5. [Network Security Groups](https://learn.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview): one per subnet.
3030
6. [Azure Log Analytics Workspace](https://learn.microsoft.com/azure/azure-monitor/logs/log-analytics-overview).
3131
7. [Azure Database for MySQL flexible server](https://learn.microsoft.com/en-us/azure/mysql/flexible-server/overview): public-access mode, Burstable `Standard_B1ms`, version 8.0.21, 32 GiB, HA disabled. A permissive firewall rule (`0.0.0.0–255.255.255.255`) lets the deploy machine reach the server for the post-create mysql bootstrap.
32-
8. [MySQL database](https://learn.microsoft.com/en-us/azure/mysql/flexible-server/how-to-create-manage-databases) `PlannerDB` (utf8mb4 / `utf8mb4_unicode_ci`).
32+
8. [MySQL database](https://learn.microsoft.com/en-us/azure/mysql/flexible-server/how-to-create-manage-databases) `plannerdb` (utf8mb4 / `utf8mb4_unicode_ci`).
3333
9. [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans).
3434
10. [Azure Web App](https://learn.microsoft.com/en-us/azure/app-service/overview) with regional VNet integration into *app-subnet*. The Bicep template sets `MYSQL_HOST`, `MYSQL_PORT`, and `MYSQL_DATABASE` on the Web App but **does not** set `MYSQL_USER` or `MYSQL_PASSWORD` — those are written by `deploy.sh` after the mysql client creates the application user.
3535

@@ -44,7 +44,7 @@ param prefix = 'local'
4444
param suffix = 'test'
4545
param runtimeName = 'python'
4646
param runtimeVersion = '3.13'
47-
param databaseName = 'PlannerDB'
47+
param databaseName = 'plannerdb'
4848
param username = 'paolo'
4949
5050
param mysqlAdminLogin = 'myadmin'
@@ -82,7 +82,7 @@ The script will:
8282
## Verification
8383

8484
```bash
85-
MYSQL_PWD='TestP@ssw0rd123' mysql -h <fqdn> -P <port> -u testuser PlannerDB \
85+
MYSQL_PWD='TestP@ssw0rd123' mysql -h <fqdn> -P <port> -u testuser plannerdb \
8686
-e "SELECT id, username, activity, created_at FROM activities;"
8787
```
8888

samples/web-app-mysql-flexible-server/python/bicep/main.bicep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ param mysqlStorageSizeGB int = 32
9696
param mysqlBackupRetentionDays int = 7
9797

9898
@description('Name of the application database to create on the MySQL flexible server.')
99-
param databaseName string = 'PlannerDB'
99+
param databaseName string = 'plannerdb'
100100

101101
//
102102
// Networking

samples/web-app-mysql-flexible-server/python/bicep/main.bicepparam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ param prefix = 'local'
44
param suffix = 'test'
55
param runtimeName = 'python'
66
param runtimeVersion = '3.13'
7-
param databaseName = 'PlannerDB'
7+
param databaseName = 'plannerdb'
88
param username = 'paolo'
99

1010
// MySQL flexible server

samples/web-app-mysql-flexible-server/python/bicep/modules/mysql-flexible-server.bicep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ param storageSizeGB int = 32
4343
param backupRetentionDays int = 7
4444

4545
@description('Specifies the name of the database to create on the server.')
46-
param databaseName string = 'PlannerDB'
46+
param databaseName string = 'plannerdb'
4747

4848
@description('Specifies the database charset.')
4949
param databaseCharset string = 'utf8mb4'

samples/web-app-mysql-flexible-server/python/scripts/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ pip install azlocal
2727
- *app-subnet*: delegated to `Microsoft.Web/serverFarms` (with NAT gateway).
2828
- *pe-subnet*: hosts the Private Endpoint (no delegation; `disable-private-endpoint-network-policies=true`).
2929
6. [Azure Database for MySQL flexible server](https://learn.microsoft.com/en-us/azure/mysql/flexible-server/overview): public-access mode, `Burstable / Standard_B1ms`, version 8.0.21, 32 GiB, HA disabled. With a permissive `AllowAllIPs` firewall rule.
30-
7. The `PlannerDB` [database](https://learn.microsoft.com/en-us/azure/mysql/flexible-server/how-to-create-manage-databases).
30+
7. The `plannerdb` [database](https://learn.microsoft.com/en-us/azure/mysql/flexible-server/how-to-create-manage-databases).
3131
8. [Azure Private DNS Zone](https://learn.microsoft.com/azure/dns/private-dns-privatednszone) `privatelink.mysql.database.azure.com`, linked to the VNet.
3232
9. [Azure Private Endpoint](https://learn.microsoft.com/azure/private-link/private-endpoint-overview) targeting the MySQL server with group `mysqlServer`, plus the DNS-zone group that auto-registers the A record.
33-
10. A separate application user (`testuser`) created via the `mysql` client, with privileges on `PlannerDB`.
33+
10. A separate application user (`testuser`) created via the `mysql` client, with privileges on `plannerdb`.
3434
11. The `activities` table and the seeded rows.
3535
12. [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans).
3636
13. [Azure Web App](https://learn.microsoft.com/en-us/azure/app-service/overview) with regional VNet integration into *app-subnet*, configured with `MYSQL_HOST`, `MYSQL_PORT`, `MYSQL_USER=testuser`, `MYSQL_PASSWORD`, `MYSQL_DATABASE`, `LOGIN_NAME`, `WEBSITES_PORT`.
@@ -58,7 +58,7 @@ bash validate.sh
5858
| --------------------- | ------------------ | --------------------------------------------- |
5959
| `MYSQL_ADMIN_USER` | `myadmin` | Server administrator login |
6060
| `MYSQL_ADMIN_PASSWORD`| `P@ssw0rd1234!` | Server administrator password (sensitive) |
61-
| `MYSQL_DATABASE_NAME` | `PlannerDB` | Application database |
61+
| `MYSQL_DATABASE_NAME` | `plannerdb` | Application database |
6262
| `MYSQL_APP_USER` | `testuser` | Application user used by the Web App |
6363
| `MYSQL_APP_PASSWORD` | `TestP@ssw0rd123` | Password for the application user |
6464

samples/web-app-mysql-flexible-server/python/scripts/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ MYSQL_SKU_NAME="Standard_B1ms"
3131
MYSQL_SKU_TIER="Burstable"
3232
MYSQL_STORAGE_SIZE_GB=32
3333
MYSQL_BACKUP_RETENTION_DAYS=7
34-
MYSQL_DATABASE_NAME="PlannerDB"
34+
MYSQL_DATABASE_NAME="plannerdb"
3535
MYSQL_ADMIN_USER="myadmin"
3636
MYSQL_ADMIN_PASSWORD="P@ssw0rd1234!"
3737
MYSQL_APP_USER="testuser"

samples/web-app-mysql-flexible-server/python/scripts/validate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ PRIVATE_ENDPOINT_NAME="${PREFIX}-mysql-pe-${SUFFIX}"
1414
APP_SERVICE_PLAN_NAME="${PREFIX}-app-service-plan-${SUFFIX}"
1515
WEB_APP_NAME="${PREFIX}-webapp-${SUFFIX}"
1616
MYSQL_SERVER_NAME="${PREFIX}-mysqlflex-${SUFFIX}"
17-
MYSQL_DATABASE_NAME="PlannerDB"
17+
MYSQL_DATABASE_NAME="plannerdb"
1818
FIREWALL_RULE_NAME="AllowAllIPs"
1919

2020
# Check resource group

samples/web-app-mysql-flexible-server/python/terraform/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The Terraform configuration provisions:
3030
6. [Network Security Groups](https://learn.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview): one per subnet.
3131
7. [Azure Log Analytics Workspace](https://learn.microsoft.com/azure/azure-monitor/logs/log-analytics-overview).
3232
8. [Azure Database for MySQL flexible server](https://learn.microsoft.com/en-us/azure/mysql/flexible-server/overview): public-access mode, Burstable `Standard_B1ms`, version 8.0.21, 32 GiB, HA disabled. A permissive firewall rule (`AllowAllIPs`, `0.0.0.0–255.255.255.255`) lets the deploy machine reach the server for the post-apply mysql bootstrap.
33-
9. [MySQL database](https://learn.microsoft.com/en-us/azure/mysql/flexible-server/how-to-create-manage-databases) `PlannerDB`.
33+
9. [MySQL database](https://learn.microsoft.com/en-us/azure/mysql/flexible-server/how-to-create-manage-databases) `plannerdb`.
3434
10. [Azure App Service Plan](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans).
3535
11. [Azure Web App](https://learn.microsoft.com/en-us/azure/app-service/overview) with regional VNet integration. `MYSQL_HOST` / `MYSQL_PORT` / `MYSQL_DATABASE` are written by Terraform; `MYSQL_USER` and `MYSQL_PASSWORD` are written by `deploy.sh` after the mysql client creates the application user.
3636

@@ -58,6 +58,6 @@ Override any of the variables in [`variables.tf`](variables.tf) by editing [`ter
5858
| `mysql_sku_name` | `B_Standard_B1ms` | Compute SKU |
5959
| `mysql_storage_size_gb` | `32` | Storage size in GB |
6060
| `mysql_backup_retention_days` | `7` | Backup retention |
61-
| `mysql_database_name` | `PlannerDB` | Application database |
61+
| `mysql_database_name` | `plannerdb` | Application database |
6262

6363
For non-dev deployments, set `mysql_admin_password` via env var: `MYSQL_ADMIN_PASSWORD=... bash deploy.sh`.

samples/web-app-mysql-flexible-server/python/terraform/modules/mysql_flexible_server/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ variable "backup_retention_days" {
4242

4343
variable "database_name" {
4444
type = string
45-
default = "PlannerDB"
45+
default = "plannerdb"
4646
}
4747

4848
variable "database_charset" {

0 commit comments

Comments
 (0)