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
# Use a managed identity to connect Azure SQL Database to an Azure Spring Apps app
12
+
# Use a managed identity to connect Azure SQL Database to an app deployed to 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.
This article shows you how to create a managed identity for an Azure Spring Apps app and use it to access Azure SQL Database.
21
+
This article shows you how to create a managed identity for an app deployed to Azure Spring Apps and use it to access Azure SQL Database.
22
22
23
23
[Azure SQL Database](https://azure.microsoft.com/services/sql-database/) is the intelligent, scalable, relational database service built for the cloud. It’s always up to date, with AI-powered and automated features that optimize performance and durability. Serverless compute and Hyperscale storage options automatically scale resources on demand, so you can focus on building new applications without worrying about storage size or resource management.
24
24
25
25
## Prerequisites
26
26
27
+
* An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
28
+
*[Azure CLI](/cli/azure/install-azure-cli) version 2.45.0 or higher.
27
29
* Follow the [Spring Data JPA tutorial](/azure/developer/java/spring-framework/configure-spring-data-jpa-with-azure-sql-server) to provision an Azure SQL Database and get it work with a Java app locally
28
-
* Follow the [Azure Spring Apps system-assigned managed identity tutorial](./how-to-enable-system-assigned-managed-identity.md) to provision an Azure Spring Apps app with MI enabled
30
+
* Follow the [Azure Spring Apps system-assigned managed identity tutorial](./how-to-enable-system-assigned-managed-identity.md) to provision an an in Azure Spring Apps with MI enabled
29
31
30
32
## Connect to Azure SQL Database with a managed identity
Configure your app deployed to Azure Spring to connect to an SQL Database with a system-assigned managed identity using the `az spring connection create` command, as shown in the following example.
66
+
Configure your app deployed to Azure Spring Apps to connect to an Azure SQL Database with a system-assigned managed identity using the `az spring connection create` command, as shown in the following example.
65
67
66
-
> [!NOTE]
67
-
> These commands require [Azure CLI](/cli/azure/install-azure-cli) version 2.45.0 or higher.
68
-
69
-
1. Install the Service Connector passwordless extension for the Azure CLI.
68
+
1. Use the following command to install the Service Connector passwordless extension for the Azure CLI:
70
69
71
70
```azurecli
72
71
az extension add --name serviceconnector-passwordless --upgrade
73
72
```
74
73
75
-
2. Run the `az spring connection create`command, as shown in the following example.
74
+
1. Use the following command to connect to the database:
76
75
77
76
```azurecli
78
77
az spring connection create sql \
@@ -85,7 +84,9 @@ Configure your app deployed to Azure Spring to connect to an SQL Database with a
85
84
--database $DATABASE_NAME \
86
85
--system-identity
87
86
```
88
-
3. Run the `az spring connection list-configuration` command as below to check the creation result.
87
+
88
+
1. Use the following command to check the creation result:
89
+
89
90
```azurecli
90
91
CONNECTION_NAME=$(az spring connection list \
91
92
--resource-group $SPRING_APP_RESOURCE_GROUP \
@@ -99,7 +100,8 @@ Configure your app deployed to Azure Spring to connect to an SQL Database with a
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.
22
22
@@ -76,50 +76,50 @@ If you don't have a deployed Azure Spring Apps instance, follow the steps in the
76
76
77
77
### [Service Connector](#tab/Service-Connector)
78
78
79
-
#### Using Azure CLI
79
+
#### Use the Azure CLI
80
80
81
-
1. Use the Azure CLI to configure your Spring app to connect to a Cosmos SQL Database with a system-assigned managed identity by using the `az spring connection create` command, as shown in the following example.
81
+
Use the following command to configure your Spring app to connect to a Cosmos SQL Database with a system-assigned managed identity:
82
82
83
-
> [!NOTE]
84
-
> Updating Azure Cosmos DB database settings can take a few minutes to complete.
> If you're using [Service Connector](../service-connector/overview.md) for the first time, start by running the command `az provider register --namespace Microsoft.ServiceLinker` to register the Service Connector resource provider.
100
-
>
101
-
> If you're using Cosmos Cassandra, use a `--key_space` instead of `--database`.
98
+
> [!NOTE]
99
+
> If you're using [Service Connector](../service-connector/overview.md) for the first time, start by running the command `az provider register --namespace Microsoft.ServiceLinker` to register the Service Connector resource provider.
100
+
>
101
+
> If you're using Cosmos Cassandra, use a `--key_space` instead of `--database`.
102
102
103
-
> [!TIP]
104
-
> Run the command `az spring connection list-support-types --output table` to get a list of supported target services and authentication methods for Azure Spring Apps. If the `az spring` command isn't recognized by the system, check that you have installed the required extension by running `az extension add --name spring`.
103
+
> [!TIP]
104
+
> Run the command `az spring connection list-support-types --output table` to get a list of supported target services and authentication methods for Azure Spring Apps. If the `az spring` command isn't recognized by the system, check that you have installed the required extension by running `az extension add --name spring`.
105
105
106
-
#### Using Azure Portal
106
+
#### Use the Azure portal
107
107
108
-
1.Alternately, you can use the Azure portal to configure this connection by completing the following steps. The Azure portal provides the same capabilities as the Azure CLI and provides an interactive experience.
108
+
Alternately, you can use the Azure portal to configure this connection by completing the following steps. The Azure portal provides the same capabilities as the Azure CLI and provides an interactive experience.
109
109
110
-
1. Select your Azure Spring Apps instance in the Azure portal and select **Apps** from the navigation menu. Choose the app you want to connect and select **Service Connector** on the navigation menu.
110
+
1. Select your Azure Spring Apps instance in the Azure portal and select **Apps** from the navigation menu. Choose the app you want to connect and select **Service Connector** on the navigation menu.
111
111
112
-
1. Select **Create**.
112
+
1. Select **Create**.
113
113
114
-
1. On the **Basics** tab, for service type, select Cosmos DB, then choose a subscription. For API type, select Core (SQL), choose a Cosmos DB account, and a database. For client type, select Java, then select **Next: Authentication**. If you haven't created your database yet, see [Quickstart: Create an Azure Cosmos DB account, database, container, and items from the Azure portal](../cosmos-db/nosql/quickstart-portal.md).
114
+
1. On the **Basics** tab, for service type, select Cosmos DB, then choose a subscription. For API type, select Core (SQL), choose a Cosmos DB account, and a database. For client type, select Java, then select **Next: Authentication**. If you haven't created your database yet, see [Quickstart: Create an Azure Cosmos DB account, database, container, and items from the Azure portal](../cosmos-db/nosql/quickstart-portal.md).
115
115
116
-
1. On the **Authentication** tab, choose **Connection string**. Service Connector automatically retrieves the access key from your Cosmos DB account. Select **Next: Networking**.
116
+
1. On the **Authentication** tab, choose **Connection string**. Service Connector automatically retrieves the access key from your Cosmos DB account. Select **Next: Networking**.
117
117
118
-
1. On the **Networking** tab, select **Configure firewall rules to enable access to target service**, then select **Next: Review + Create**.
118
+
1. On the **Networking** tab, select **Configure firewall rules to enable access to target service**, then select **Next: Review + Create**.
119
119
120
-
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.
120
+
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.
121
121
122
-
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.
122
+
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
123
124
124
### [Service Binding](#tab/Service-Binding)
125
125
@@ -156,7 +156,7 @@ Azure Cosmos DB has five different API types that support binding. The following
156
156
157
157
### [Terraform](#tab/Terraform)
158
158
159
-
The following Terraform script shows how to set up an Azure Spring Apps app with an Azure Cosmos DB account.
159
+
The following Terraform script shows how to set up an app deployed to Azure Spring Apps with an Azure Cosmos DB account.
0 commit comments