You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/spring-apps/quickstart-integrate-azure-database-mysql.md
+21-48Lines changed: 21 additions & 48 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ Pet Clinic, as deployed in the default configuration [Quickstart: Build and depl
24
24
25
25
## Variables preparation
26
26
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.).
28
28
29
29
```bash
30
30
export RESOURCE_GROUP=<resource-group-name># customize this
az configure --defaults group=<resource group name> spring-cloud=<service name>
45
45
```
46
46
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.
48
48
49
49
```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 \
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
+
```
78
52
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.
84
55
85
-
---
56
+
1. A CLI prompt asks if you want to enable access to your IP. Enter `Y` to confirm.
86
57
87
58
## Connect your application to the MySQL database
88
59
@@ -96,21 +67,21 @@ Use [Service Connector](/service-connector/overview) to connect the app hosted i
96
67
az provider register -n Microsoft.ServiceLinker
97
68
```
98
69
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.
| **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. |
| **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.":::
137
110
138
111
1. Select **Next: Authentication** to select the authentication type. Then select **Connection string > Database credentials** and enter your database username and password.
139
112
@@ -147,7 +120,7 @@ Use [Service Connector](/service-connector/overview) to connect the app hosted i
147
120
148
121
### [Azure CLI](#tab/azure-cli)
149
122
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.
151
124
152
125
```azurecli-interactive
153
126
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