Skip to content

Commit 10f4530

Browse files
committed
Scenario for flexible server
1 parent 99426dc commit 10f4530

File tree

2 files changed

+21
-48
lines changed

2 files changed

+21
-48
lines changed
33.1 KB
Loading

articles/spring-apps/quickstart-integrate-azure-database-mysql.md

Lines changed: 21 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Pet Clinic, as deployed in the default configuration [Quickstart: Build and depl
2424

2525
## Variables preparation
2626

27-
We will use the following values. Save them in a text file or environment variables to avoid errors. The password should be at least 8 characters long and contain at least one English uppercase letter, one English lowercase letter, one number, and one non-alphanumeric character (!, $, #, %, and so on.).
27+
We'll use the following values. Save them in a text file or environment variables to avoid errors. The password should be at least 8 characters long and contain at least one English uppercase letter, one English lowercase letter, one number, and one non-alphanumeric character (!, $, #, %, and so on.).
2828

2929
```bash
3030
export RESOURCE_GROUP=<resource-group-name> # customize this
@@ -44,45 +44,16 @@ export MYSQL_DATABASE_NAME=petclinic
4444
az configure --defaults group=<resource group name> spring-cloud=<service name>
4545
```
4646

47-
1. Create an Azure Database for MySQL server.
47+
1. Create an Azure Database for MySQL flexible servers [az mysql flexible-server create](/cli/azure/mysql/flexible-server#az-mysql-flexible-server-create) command below. Replace the placeholders `<database-name>`, `<resource-group-name>`, `<MySQL-flexible-server-name>`, `<admin-username>`, and `<admin-password>` with a name for your new database, the name of your resource group, a name for your new server, and an admin username and password.
4848

4949
```azcli
50-
az mysql server create --resource-group ${RESOURCE_GROUP} \
51-
--name ${MYSQL_SERVER_NAME} \
52-
--admin-user ${MYSQL_SERVER_ADMIN_NAME} \
53-
--admin-password ${MYSQL_SERVER_ADMIN_PASSWORD} \
54-
--sku-name GP_Gen5_2 \
55-
--ssl-enforcement Disabled \
56-
--version 5.7
57-
```
58-
59-
1. Allow access from your dev machine for testing.
60-
61-
```azcli
62-
az mysql server firewall-rule create --name devMachine \
63-
--server ${MYSQL_SERVER_NAME} \
64-
--resource-group ${RESOURCE_GROUP} \
65-
--start-ip-address <ip-address-of-your-dev-machine> \
66-
--end-ip-address <ip-address-of-your-dev-machine>
67-
```
68-
69-
1. Increase connection timeout.
70-
71-
```azcli
72-
az mysql server configuration set --name wait_timeout \
73-
--resource-group ${RESOURCE_GROUP} \
74-
--server ${MYSQL_SERVER_NAME} --value 2147483
75-
```
76-
77-
## Create a MySQL database
50+
az mysql flexible-server create --database-name <database-name> --resource-group <resource-group-name> --name <MySQL-flexible-server-name> --admin-user <admin-username> --admin-password <admin-password>
51+
```
7852
79-
Create a MySQL database in Azure with the [az msql db create](/cli/azure/mysql/db#az-mysql-db-create) command below. Replace the placeholders `<database-name>`, `<resource-group-name>` and `<server-name>` with a name for your new database, the name of a resource group, and a server name.
80-
81-
```azurecli-interactive
82-
az mysql db create --name <database-name> --resource-group <resource-group-name> --server-name <server-name>
83-
```
53+
> [!NOTE]
54+
> Standard_B1ms SKU is used by default. Refer to [Azure Database for MySQL pricing](https://azure.microsoft.com/pricing/details/mysql/flexible-server/) for pricing details.
8455
85-
---
56+
1. A CLI prompt asks if you want to enable access to your IP. Enter `Y` to confirm.
8657
8758
## Connect your application to the MySQL database
8859
@@ -96,21 +67,21 @@ Use [Service Connector](/service-connector/overview) to connect the app hosted i
9667
az provider register -n Microsoft.ServiceLinker
9768
```
9869
99-
1. Run the `az spring connection create` command to create a service connection between Azure Spring Apps and the Azure MySQL database. Replace the placeholders below by the your own information.
70+
1. Run the `az spring connection create` command to create a service connection between Azure Spring Apps and the Azure MySQL database. Replace the placeholders below by your own information.
10071
10172
| Setting | Description |
10273
|---------------------------|----------------------------------------------------------------------------------------------|
10374
| `--resource-group` | The name of the resource group that contains the app hosted by Azure Spring Apps. |
10475
| `--service` | The name of the Azure Spring Apps resource. |
105-
| `--app` | The name of the application hosted by Azure Spring Apps that connects to the target service. |
76+
| `--app` | The name of the application hosted by Azure Spring Apps that connects to the target service. |
10677
| `--target-resource-group` | The name of the resource group with the storage account. |
10778
| `--server` | The MySQL server you want to connect to |
10879
| `--database` | The name of the database you created earlier. |
10980
| `--secret name` | The MySQL server username. |
11081
| `--secret` | The MySQL server password. |
11182
11283
```azurecli-interactive
113-
az spring connection create mysql --resource-group <Azure-Spring-Apps-resource-group-name> --service <Azure-Spring-Apps-resource-name> --app <app-name> --target-resource-group <mySQL-server-resource-group> --server <server-name> --database <database-name> --secret name=<username> secret=<secret>
84+
az spring connection create mysql-flexible --resource-group <Azure-Spring-Apps-resource-group-name> --service <Azure-Spring-Apps-resource-name> --app <app-name> --target-resource-group <mySQL-server-resource-group> --server <server-name> --database <database-name> --secret name=<username> secret=<secret>
11485
```
11586
11687
> [!TIP]
@@ -126,14 +97,16 @@ Use [Service Connector](/service-connector/overview) to connect the app hosted i
12697
12798
1. Select or enter the following settings in the table.
12899
129-
| Setting | Example | Description |
130-
|---------------------|------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
131-
| **Service type** | *DB for MySQL single server* | Select the MySQL target service to connect the app to the MySQL database. |
132-
| **Subscription** | *my-subscription* | The subscription that contains your target service (the service you want to connect to). The default value is the subscription that contains the app deployed to Azure Spring Apps. |
133-
| **Connection name** | *mysql_rk29a* | The connection name that identifies the connection between your app and target service. Use the connection name provided by Service Connector or enter your own connection name. |
134-
| **MySQL server** | *MySQL80* | Select the MySQL server you want to connect to. |
135-
| **MySQL database** | *petclinic* | Select the database you created earlier. |
136-
| **Client type** | *.NET* | Select the application stack that works with the target service you selected. |
100+
| Setting | Example | Description |
101+
|---------------------------|--------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
102+
| **Service type** | *DB for MySQL flexible server* | Select DB for MySQL flexible server as your target service |
103+
| **Subscription** | *my-subscription* | The subscription that contains your target service. The default value is the subscription that contains the app deployed to Azure Spring Apps. |
104+
| **Connection name** | *mysql_rk29a* | The connection name that identifies the connection between your app and target service. Use the connection name provided by Service Connector or enter your own connection name. |
105+
| **MySQL flexible server** | *MySQL80* | Select the MySQL flexible server you want to connect to. |
106+
| **MySQL database** | *petclinic* | Select the database you created earlier. |
107+
| **Client type** | *.NET* | Select the application stack that works with the target service you selected. |
108+
109+
:::image type="content" source="./media\quickstart-integrate-azure-database-mysql\basics-tab.png" alt-text="Screenshot of the Azure portal, filling out the basics tab in Service Connector.":::
137110
138111
1. Select **Next: Authentication** to select the authentication type. Then select **Connection string > Database credentials** and enter your database username and password.
139112
@@ -147,7 +120,7 @@ Use [Service Connector](/service-connector/overview) to connect the app hosted i
147120
148121
### [Azure CLI](#tab/azure-cli)
149122
150-
Run the `az spring connection validate` command to show the status of the connection between Azure Spring Apps and the Azure MySQL database. Replace the placeholders below by the your own information.
123+
Run the `az spring connection validate` command to show the status of the connection between Azure Spring Apps and the Azure MySQL database. Replace the placeholders below by your own information.
151124
152125
```azurecli-interactive
153126
az spring connection validate --connection <connection-name> --resource-group <Azure-Spring-Apps-resource-group-name> --service <Azure-Spring-Apps-resource-name> --app <app-name>

0 commit comments

Comments
 (0)