Skip to content

Commit 81f68fb

Browse files
authored
Merge pull request #97378 from moarychan/moary/update-tutorial-spring-keyvault
Update tutorial-managed-identities-key-vault.md
2 parents d6888a8 + 30ee77f commit 81f68fb

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed
-115 KB
Loading

articles/spring-apps/tutorial-managed-identities-key-vault.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,13 @@ export SERVICE_IDENTITY=$(az spring app show --name "springapp" -s "myspringclou
9393

9494
### [User-assigned managed identity](#tab/user-assigned-managed-identity)
9595

96-
First, create a user-assigned managed identity in advance with its resource ID set to `$USER_IDENTITY_RESOURCE_ID`.
96+
First, create a user-assigned managed identity in advance with its resource ID set to `$USER_IDENTITY_RESOURCE_ID`. Save the client ID for the property configuration below.
9797

98-
:::image type="content" source="media/tutorial-managed-identities-key-vault/app-user-managed-identity-key-vault.png" alt-text="Screenshot of Azure portal showing the Managed Identity Properties screen with 'Principle I D' and 'Client I D' highlighted." lightbox="media/tutorial-managed-identities-key-vault/app-user-managed-identity-key-vault.png":::
98+
:::image type="content" source="media/tutorial-managed-identities-key-vault/app-user-managed-identity-key-vault.png" alt-text="Screenshot of Azure portal showing the Managed Identity Properties screen with 'Resource ID', 'Principle ID' and 'Client ID' highlighted." lightbox="media/tutorial-managed-identities-key-vault/app-user-managed-identity-key-vault.png":::
9999

100100
```azurecli
101101
export SERVICE_IDENTITY={principal ID of user-assigned managed identity}
102102
export USER_IDENTITY_RESOURCE_ID={resource ID of user-assigned managed identity}
103-
export USER_IDENTITY_CLIENT_ID={client ID of user-assigned managed identity}
104103
```
105104

106105
The following example creates an app named `springapp` with a user-assigned managed identity, as requested by the `--user-assigned` parameter.
@@ -143,7 +142,7 @@ This app will have access to get secrets from Azure Key Vault. Use the Azure Key
143142
1. Use the following command to generate a sample project from `start.spring.io` with Azure Key Vault Spring Starter.
144143

145144
```azurecli
146-
curl https://start.spring.io/starter.tgz -d dependencies=web,azure-keyvault-secrets -d baseDir=springapp -d bootVersion=2.3.1.RELEASE -d javaVersion=1.8 | tar -xzvf -
145+
curl https://start.spring.io/starter.tgz -d dependencies=web,azure-keyvault -d baseDir=springapp -d bootVersion=2.7.2 -d javaVersion=1.8 | tar -xzvf -
147146
```
148147

149148
1. Specify your Key Vault in your app.
@@ -158,16 +157,16 @@ This app will have access to get secrets from Azure Key Vault. Use the Azure Key
158157
### [System-assigned managed identity](#tab/system-assigned-managed-identity)
159158

160159
```properties
161-
azure.keyvault.enabled=true
162-
azure.keyvault.uri=https://<your-keyvault-name>.vault.azure.net
160+
spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=https://<your-keyvault-name>.vault.azure.net
161+
spring.cloud.azure.keyvault.secret.property-sources[0].credential.managed-identity-enabled=true
163162
```
164163

165164
### [User-assigned managed identity](#tab/user-assigned-managed-identity)
166165

167166
```properties
168-
azure.keyvault.enabled=true
169-
azure.keyvault.uri=https://<your-keyvault-name>.vault.azure.net
170-
azure.keyvault.client-id={Client ID of user-assigned managed identity}
167+
spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=https://<your-keyvault-name>.vault.azure.net
168+
spring.cloud.azure.keyvault.secret.property-sources[0].credential.managed-identity-enabled=true
169+
spring.cloud.azure.keyvault.secret.property-sources[0].credential.client-id={Client ID of user-assigned managed identity}
171170
```
172171

173172
---
@@ -209,19 +208,19 @@ azure.keyvault.client-id={Client ID of user-assigned managed identity}
209208
}
210209
```
211210

212-
If you open the *pom.xml* file, you'll see the dependency of `azure-keyvault-secrets-spring-boot-starter`. Add this dependency to your project in your *pom.xml* file.
211+
If you open the *pom.xml* file, you'll see the dependency of `spring-cloud-azure-starter-keyvault`.
213212

214213
```xml
215214
<dependency>
216-
<groupId>com.microsoft.azure</groupId>
217-
<artifactId>azure-keyvault-secrets-spring-boot-starter</artifactId>
215+
<groupId>com.azure.spring</groupId>
216+
<artifactId>spring-cloud-azure-starter-keyvault</artifactId>
218217
</dependency>
219218
```
220219

221220
1. Use the following command to package your sample app.
222221

223222
```azurecli
224-
mvn clean package
223+
./mvnw clean package -DskipTests
225224
```
226225

227226
1. Now you can deploy your app to Azure with the following command:
@@ -231,7 +230,7 @@ azure.keyvault.client-id={Client ID of user-assigned managed identity}
231230
--resource-group <your-resource-group-name> \
232231
--name "springapp" \
233232
--service <your-Azure-Spring-Apps-instance-name> \
234-
--jar-path target/demo-0.0.1-SNAPSHOT.jar
233+
--artifact-path target/demo-0.0.1-SNAPSHOT.jar
235234
```
236235

237236
1. To test your app, access the public endpoint or test endpoint by using the following command:

0 commit comments

Comments
 (0)