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/tutorial-managed-identities-mysql.md
+43-43Lines changed: 43 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,29 +36,29 @@ The following video describes how to manage secrets using Azure Key Vault.
36
36
A resource group is a logical container where Azure resources are deployed and managed. Create a resource group to contain both the Key Vault and Spring Cloud using the command [az group create](/cli/azure/group#az-group-create):
37
37
38
38
```azurecli
39
-
az group create --location <myLocation> --name <myResourceGroup>
39
+
az group create --location <location> --name <resource-group-name>
40
40
```
41
41
42
42
## Set up your Key Vault
43
43
44
44
To create a Key Vault, use the command [az keyvault create](/cli/azure/keyvault#az-keyvault-create):
45
45
46
46
> [!IMPORTANT]
47
-
> Each Key Vault must have a unique name. Replace *\<myKeyVaultName>* with the name of your Key Vault in the following examples.
47
+
> Each Key Vault must have a unique name. Replace *\<key-vault-name>* with the name of your Key Vault in the following examples.
48
48
49
49
```azurecli
50
-
az keyvault create --name <myKeyVaultName> -g <myResourceGroup>
50
+
az keyvault create --resource-group <resource-group-name> --name <key-vault-name>
51
51
```
52
52
53
-
Make a note of the returned `vaultUri`, which will be in the format `https://<your-keyvault-name>.vault.azure.net`. It will be used in the following step.
53
+
Make a note of the returned `vaultUri`, which will be in the format `https://<key-vault-name>.vault.azure.net`. It will be used in the following step.
54
54
55
55
You can now place a secret in your Key Vault with the command [az keyvault secret set](/cli/azure/keyvault/secret#az-keyvault-secret-set):
56
56
57
57
```azurecli
58
58
az keyvault secret set \
59
-
--vault-name <your-keyvault-name> \
60
-
--name <MYSQL-PASSWORD> \
61
-
--value <MySQL-PASSWORD>
59
+
--vault-name <key-vault-name> \
60
+
--name <mysql-password> \
61
+
--value <mysql-password>
62
62
```
63
63
64
64
## Set up your Azure Database for MySQL
@@ -69,9 +69,9 @@ Create a database named *demo* for later use.
69
69
70
70
```azurecli
71
71
az mysql db create \
72
-
--resource-group <myResourceGroup> \
72
+
--resource-group <resource-group-name> \
73
73
--name demo \
74
-
--server-name <mysqlName>
74
+
--server-name <mysql-instance-name>
75
75
```
76
76
77
77
## Create an app and service in Azure Spring Apps
@@ -80,84 +80,84 @@ After installing the corresponding extension, create an Azure Spring Apps instan
80
80
81
81
```azurecli
82
82
az extension add --name spring
83
-
az spring create --name <myService> --group <myResourceGroup>
83
+
az spring create --name <Azure-Spring-Apps-instance-name> --resource-group <resource-group-name>
84
84
```
85
85
86
86
The following example creates an app named `springapp` with a system-assigned managed identity, as requested by the `--assign-identity` parameter.
87
87
88
88
```azurecli
89
89
az spring app create \
90
+
--resource-group <resource-group-name> \
91
+
--service <Azure-Spring-Apps-instance-name>
90
92
--name springapp
91
-
--service <myService>
92
-
--group <myResourceGroup> \
93
93
--assign-endpoint true \
94
94
--assign-identity
95
-
export SERVICE_IDENTITY=$(az spring app show --name springapp -s <myService> -g <myResourceGroup> | jq -r '.identity.principalId')
95
+
export SERVICE_IDENTITY=$(az spring app show --name springapp -s <Azure-Spring-Apps-instance-name> -g <resource-group-name> | jq -r '.identity.principalId')
96
96
```
97
97
98
-
Make a note of the returned `url`, which will be in the format `https://<your-app-name>.azuremicroservices.io`. It will be used in the following step.
98
+
Make a note of the returned `url`, which will be in the format `https://<app-name>.azuremicroservices.io`. It will be used in the following step.
99
99
100
100
## Grant your app access to Key Vault
101
101
102
102
Use [az keyvault set-policy](/cli/azure/keyvault#az-keyvault-set-policy) to grant proper access in Key Vault for your app.
103
103
104
104
```azurecli
105
105
az keyvault set-policy
106
-
--name <myKeyVaultName> \
106
+
--name <key-vault-name> \
107
107
--object-id ${SERVICE_IDENTITY} \
108
108
--secret-permissions set get list
109
109
```
110
110
111
111
> [!NOTE]
112
-
> Use `az keyvault delete-policy --name <myKeyVaultName> --object-id ${SERVICE_IDENTITY}` to remove the access for your app after system-assigned managed identity is disabled.
112
+
> Use `az keyvault delete-policy --name <key-vault-name> --object-id ${SERVICE_IDENTITY}` to remove the access for your app after system-assigned managed identity is disabled.
113
113
114
114
## Build a sample Spring Boot app with Spring Boot starter
115
115
116
116
This [sample](https://github.com/Azure-Samples/Azure-Spring-Cloud-Samples/tree/master/managed-identity-mysql) will create an entry and list entires from MySQL.
0 commit comments