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
# Bind an Azure Cosmos DB database to your application in Azure Spring Apps
12
+
# Connect an Azure Cosmos DB database to your application in Azure Spring Apps
13
13
14
14
> [!NOTE]
15
15
> Azure Spring Apps is the new name for the Azure Spring Cloud service. Although the service has a new name, you'll see the old name in some places for a while as we work to update assets such as screenshots, videos, and diagrams.
Instead of manually configuring your Spring Boot applications, you can automatically bind select Azure services to your applications by using Azure Spring Apps. This article demonstrates how to bind your application to an Azure Cosmos DB database.
21
+
Instead of manually configuring your Spring Boot applications, you can automatically connect selected Azure services to your applications by using Azure Spring Apps. This article demonstrates how to connect your application to an Azure Cosmos DB database.
22
22
23
23
## Prerequisites
24
24
25
-
* A deployed Azure Spring Apps instance.
26
-
* An Azure Cosmos DB account and a database.
27
-
* The Azure Spring Apps extension for the Azure CLI.
28
-
29
-
If you don't have a deployed Azure Spring Apps instance, follow the steps in the [Quickstart: Deploy your first application to Azure Spring Apps](./quickstart.md).
25
+
* An application deployed to Azure Spring Apps. For more information, see [Quickstart: Deploy your first application to Azure Spring Apps](./quickstart.md).
26
+
* An Azure Cosmos DB database instance.
27
+
*[Azure CLI](/cli/azure/install-azure-cli) version 2.45.0 or higher.
30
28
31
29
## Prepare your Java project
32
30
33
-
1. Add one of the following dependencies to your application's pom.xml pom.xml file. Choose the dependency that is appropriate for your API type.
31
+
1. Add one of the following dependencies to your application's *pom.xml* file. Choose the dependency that is appropriate for your API type.
1. Update the current app by running `az spring app deploy`, or create a new deployment for this change by running `az spring app deployment create`.
74
61
75
-
## Bind your app to the Azure Cosmos DB
62
+
## Connect your app to the Azure Cosmos DB
76
63
77
64
### [Service Connector](#tab/Service-Connector)
78
65
79
66
#### Use the Azure CLI
80
67
81
-
Use the following command to configure your Spring app to connect to a Cosmos SQL Database with a system-assigned managed identity:
68
+
Use the Azure CLI to configure your Spring app to connect to a Cosmos SQL Database by using the `az spring connection create` command, as shown in the following example:
82
69
83
70
> [!NOTE]
84
71
> Updating Azure Cosmos DB database settings can take a few minutes to complete.
@@ -92,7 +79,7 @@ az spring connection create cosmos-sql \
@@ -121,39 +108,6 @@ Alternately, you can use the Azure portal to configure this connection by comple
121
108
122
109
1. Once the connection between your Spring apps and your Cosmos DB database has been generated, you can see it in the Service Connector page and select the unfold button to view the configured connection variables.
123
110
124
-
### [Service Binding](#tab/Service-Binding)
125
-
126
-
> [!NOTE]
127
-
> We recommend using Service Connector instead of Service Binding to connect your app to your database. Service Binding is going to be deprecated in favor of Service Connector. For instructions, see the Service Connector tab.
128
-
129
-
Azure Cosmos DB has five different API types that support binding. The following procedure shows how to use them:
130
-
131
-
1. Create an Azure Cosmos DB database. Refer to the quickstart on [creating a database](../cosmos-db/create-cosmosdb-resources-portal.md) for help.
132
-
133
-
1. Record the name of your database. For this procedure, the database name is **testdb**.
134
-
135
-
1. Go to your Azure Spring Apps service page in the Azure portal. Go to **Application Dashboard** and select the application to bind to Azure Cosmos DB. This application is the same one you updated or deployed in the previous step.
136
-
137
-
1. Select **Service binding**, and select **Create service binding**. To fill out the form, select:
138
-
139
-
* The **Binding type** value **Azure Cosmos DB**.
140
-
* The API type.
141
-
* Your database name.
142
-
* The Azure Cosmos DB account.
143
-
144
-
> [!NOTE]
145
-
> If you are using Cassandra, use a key space for the database name.
146
-
147
-
1. Restart the application by selecting **Restart** on the application page.
148
-
149
-
1. To ensure the service is bound correctly, select the binding name and verify its details. The `property` field should be similar to this example:
In this article, you learned how to bind your application in Azure Spring Apps to an Azure Cosmos DB database. To learn more about binding services to your application, see [Bind to an Azure Cache for Redis cache](./how-to-bind-redis.md).
196
+
In this article, you learned how to connect your application in Azure Spring Apps to an Azure Cosmos DB database. To learn more about connecting services to your application, see [Connect to an Azure Cache for Redis cache](./how-to-bind-redis.md).
# Bind an Azure Database for MySQL instance to your application in Azure Spring Apps
12
+
# Connect an Azure Database for MySQL instance to your application in Azure Spring Apps
13
13
14
14
> [!NOTE]
15
15
> Azure Spring Apps is the new name for the Azure Spring Cloud service. Although the service has a new name, you'll see the old name in some places for a while as we work to update assets such as screenshots, videos, and diagrams.
With Azure Spring Apps, you can bind select Azure services to your applications automatically, instead of having to configure your Spring Boot application manually. This article shows you how to bind your application to your Azure Database for MySQL instance.
21
+
With Azure Spring Apps, you can connect selected Azure services to your applications automatically, instead of having to configure your Spring Boot application manually. This article shows you how to connect your application to your Azure Database for MySQL instance.
22
22
23
23
## Prerequisites
24
24
@@ -45,7 +45,7 @@ With Azure Spring Apps, you can bind select Azure services to your applications
45
45
46
46
1. Update the current app by running `az spring app deploy`, or create a new deployment for this change by running `az spring app deployment create`.
47
47
48
-
## Bind your app to the Azure Database for MySQL instance
48
+
## Connect your app to the Azure Database for MySQL instance
49
49
50
50
### [Service Connector](#tab/Service-Connector)
51
51
@@ -56,7 +56,7 @@ Follow these steps to configure your Spring app to connect to an Azure Database
56
56
```azurecli
57
57
az extension add --name serviceconnector-passwordless --upgrade
58
58
```
59
-
59
+
60
60
1. Run the `az spring connection create` command, as shown in the following example.
61
61
62
62
```azurecli
@@ -68,33 +68,7 @@ Follow these steps to configure your Spring app to connect to an Azure Database
68
68
--target-resource-group $MYSQL_RESOURCE_GROUP \
69
69
--server $MYSQL_SERVER_NAME \
70
70
--database $DATABASE_NAME \
71
-
--system-assigned-identity
72
-
```
73
-
74
-
### [Service Binding](#tab/Service-Binding)
75
-
76
-
> [!NOTE]
77
-
> We recommend using Service Connector instead of Service Binding to connect your app to your database. Service Binding is going to be deprecated in favor of Service Connector. For instructions, see the Service Connector tab.
78
-
79
-
1. Note the admin username and password of your Azure Database for MySQL account.
80
-
81
-
1. Connect to the server, create a database named **testdb** from a MySQL client, and then create a new non-admin account.
82
-
83
-
1. In the Azure portal, on your **Azure Spring Apps** service page, look for the **Application Dashboard**, and then select the application to bind to your Azure Database for MySQL instance. This is the same application that you updated or deployed in the previous step.
84
-
85
-
1. Select **Service binding**, and then select the **Create service binding** button.
86
-
87
-
1. Fill out the form, selecting **Azure MySQL** as the **Binding type**, using the same database name you used earlier, and using the same username and password you noted in the first step.
88
-
89
-
1. Restart the app, and this binding should now work.
90
-
91
-
1. To ensure that the service binding is correct, select the binding name, and then verify its detail. The `property` field should look like this:
In this article, you learned how to bind an application in Azure Spring Apps to an Azure Database for MySQL instance. To learn more about binding services to an application, see [Bind an Azure Cosmos DB database to an application in Azure Spring Apps](./how-to-bind-cosmos.md).
186
+
In this article, you learned how to connect an application in Azure Spring Apps to an Azure Database for MySQL instance. To learn more about connecting services to an application, see [Connect an Azure Cosmos DB database to an application in Azure Spring Apps](./how-to-bind-cosmos.md).
# Bind Azure Cache for Redis to your application in Azure Spring Apps
12
+
# Connect Azure Cache for Redis to your application in Azure Spring Apps
13
13
14
14
> [!NOTE]
15
15
> Azure Spring Apps is the new name for the Azure Spring Cloud service. Although the service has a new name, you'll see the old name in some places for a while as we work to update assets such as screenshots, videos, and diagrams.
Instead of manually configuring your Spring Boot applications, you can automatically bind select Azure services to your applications by using Azure Spring Apps. This article shows how to bind your application to Azure Cache for Redis.
21
+
Instead of manually configuring your Spring Boot applications, you can automatically connect selected Azure services to your applications by using Azure Spring Apps. This article shows how to connect your application to Azure Cache for Redis.
22
22
23
23
## Prerequisites
24
24
@@ -43,7 +43,7 @@ If you don't have a deployed Azure Spring Apps instance, follow the steps in the
43
43
44
44
1. Update the current deployment using `az spring app update` or create a new deployment using `az spring app deployment create`.
45
45
46
-
## Bind your app to the Azure Cache for Redis
46
+
## Connect your app to the Azure Cache for Redis
47
47
48
48
### [Service Connector](#tab/Service-Connector)
49
49
@@ -77,34 +77,14 @@ If you don't have a deployed Azure Spring Apps instance, follow the steps in the
77
77
78
78
1. On the **Basics** tab, for service type, select Cache for Redis. Choose a subscription and a Redis cache server. Fill in the Redis database name ("0" in this example) and under client type, select Java. Select **Next: Authentication**.
79
79
80
-
1. On the **Authentication** tab, choose **Connection string**. Service Connector will automatically retrieve the access key from your Redis database account. Select **Next: Networking**.
80
+
1. On the **Authentication** tab, choose **Connection string**. Service Connector automatically retrieves the access key from your Redis database account. Select **Next: Networking**.
81
81
82
82
1. On the **Networking** tab, select **Configure firewall rules to enable access to target service**, then select **Review + Create**.
83
83
84
84
1. On the **Review + Create** tab, wait for the validation to pass and then select **Create**. The creation can take a few minutes to complete.
85
85
86
86
1. Once the connection between your Spring app your Redis database has been generated, you can see it in the Service Connector page and select the unfold button to view the configured connection variables.
87
87
88
-
### [Service Binding](#tab/Service-Binding)
89
-
90
-
> [!NOTE]
91
-
> We recommend using Service Connector instead of Service Binding to connect your app to your database. Service Binding is going to be deprecated in favor of Service Connector. For instructions, see the Service Connector tab.
92
-
93
-
1. Go to your Azure Spring Apps service page in the Azure portal. Go to **Application Dashboard** and select the application to bind to Azure Cache for Redis. This application is the same one you updated or deployed in the previous step.
94
-
95
-
1. Select **Service binding** and select **Create service binding**. Fill out the form, being sure to select the **Binding type** value **Azure Cache for Redis**, your Azure Cache for Redis server, and the **Primary** key option.
96
-
97
-
1. Restart the app. The binding should now work.
98
-
99
-
1. To ensure the service binding is correct, select the binding name and verify its details. The `property` field should look like this:
In this article, you learned how to bind your application in Azure Spring Apps to Azure Cache for Redis. To learn more about binding services to your application, see [Bind to an Azure Database for MySQL instance](./how-to-bind-mysql.md).
162
+
In this article, you learned how to connect your application in Azure Spring Apps to Azure Cache for Redis. To learn more about connecting services to your application, see [Connect to an Azure Database for MySQL instance](./how-to-bind-mysql.md).
0 commit comments