Skip to content

Commit d14a407

Browse files
authored
add feature decscription in readme (Azure#13851)
1 parent f479be5 commit d14a407

File tree

4 files changed

+62
-9
lines changed

4 files changed

+62
-9
lines changed

sdk/spring/azure-spring-boot-starter-keyvault-secrets/README.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,26 @@ From a developer's perspective, Key Vault APIs accept and return secret values a
3030

3131
For highly sensitive data, clients should consider additional layers of protection for data. Encrypting data using a separate protection key prior to storage in Key Vault is one example.
3232

33-
Key Vault also supports a contentType field for secrets. Clients may specify the content type of a secret to assist in interpreting the secret data when it's retrieved. The maximum length of this field is 255 characters. There are no pre-defined values. The suggested usage is as a hint for interpreting the secret data. For instance, an implementation may store both passwords and certificates as secrets, then use this field to differentiate. There are no predefined values.
33+
Key Vault also supports a contentType field for secrets. Clients may specify the content type of a secret to assist in interpreting the secret data when it's retrieved. The maximum length of this field is 255 characters. There are no pre-defined values. The suggested usage is as a hint for interpreting the secret data.
34+
35+
Besides, this starter provides features of supporting multiple Key Vaults, case sensitive mode of Key Vault names and using placeholder presenting Key Vault names in property file
36+
### Multiple Key Vault support
37+
38+
If you want to use multiple Key Vaults you need to define names for each of the
39+
Key Vaults you want to use and in which order the Key Vaults should be consulted.
40+
If a property exists in multiple Key Vaults the order determine which value you
41+
will get back.
42+
43+
### Case sensitive key mode
44+
45+
The new case sensitive mode allows you to use case sensitive Key Vault names. Note
46+
that the Key Vault secret key still needs to honor the naming limitation as
47+
described in the “keyvault-name” element of [About keys, secrets, and certificates](https://docs.microsoft.com/en-us/azure/key-vault/general/about-keys-secrets-certificates).
48+
49+
If your Spring property is using a name that does not honor the Key Vault secret
50+
key limitation use the following technique as described by
51+
[Externalized Configuration](https://docs.spring.io/autorepo/docs/spring-boot/current/reference/html/spring-boot-features.html#boot-features-external-config-placeholders-in-properties)
52+
in the Spring Boot documentation.
3453

3554
## Examples
3655
### Custom settings
@@ -111,6 +130,40 @@ public class KeyVaultSample implements CommandLineRunner {
111130
}
112131
```
113132

133+
### Multiple Key Vault support
134+
The example below shows a setup for 2 key vaults, named `keyvault1` and
135+
`keyvault2`. The order specifies that `keyvault1` will be consulted first.
136+
137+
```
138+
azure.keyvault.order=keyvault1,keyvault2
139+
azure.keyvault.keyvault1.uri=put-a-azure-keyvault-uri-here
140+
azure.keyvault.keyvault1.client-id=put-a-azure-client-id-here
141+
azure.keyvault.keyvault1.client-key=put-a-azure-client-key-here
142+
azure.keyvault.keyvault1.tenant-id=put-a-azure-tenant-id-here
143+
azure.keyvault.keyvault2.uri=put-a-azure-keyvault-uri-here
144+
azure.keyvault.keyvault2.client-id=put-a-azure-client-id-here
145+
azure.keyvault.keyvault2.client-key=put-a-azure-client-key-here
146+
azure.keyvault.keyvault2.tenant-id=put-a-azure-tenant-id-here
147+
```
148+
Note if you decide to use multiple key vault support and you already have an
149+
existing configuration, please make sure you migrate that configuration to the
150+
multiple key vault variant. Mixing multiple key vaults with an existing single
151+
key vault configuration is a non supported scenario.
152+
153+
### Case sensitive key mode
154+
To enable case sensitive mode, you can set the following property in the `appliation.properties`:
155+
```
156+
azure.keyvault.case-sensitive-keys=true
157+
```
158+
If your Spring property is using a name that does not honor the Key Vault secret key limitation use placeholders in properties. An example of using a placeholder:
159+
```
160+
my.not.compliant.property=${myCompliantKeyVaultSecret}
161+
```
162+
163+
The application will take care of getting the value that is backed by the
164+
`myCompliantKeyVaultSecret` key name and assign its value to the non compliant
165+
`my.not.compliant.property`.
166+
114167
## Troubleshooting
115168
### Enable client logging
116169
Azure SDKs for Java offer a consistent logging story to help aid in troubleshooting application errors and expedite their resolution. The logs produced will capture the flow of an application before reaching the terminal state to help locate the root issue. View the [logging][logging] wiki for guidance about enabling logging.

sdk/spring/azure-spring-boot-starter-servicebus-jms/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ public class SendController {
142142

143143
private static final String QUEUE_NAME = "<ServiceBusQueueName>";
144144

145-
private final Logger LOGGER = LoggerFactory.getLogger(QueueReceiveController.class);
145+
private final Logger logger = LoggerFactory.getLogger(QueueReceiveController.class);
146146

147147
@JmsListener(destination = QUEUE_NAME, containerFactory = "jmsListenerContainerFactory")
148148
public void receiveMessage(User user) {
149-
LOGGER.info("Received message: {}", user.getName());
149+
logger.info("Received message: {}", user.getName());
150150
}
151151
}
152152
```
@@ -172,12 +172,12 @@ public class SendController {
172172

173173
private static final String SUBSCRIPTION_NAME = "<ServiceBusSubscriptionName>";
174174

175-
private final Logger LOGGER = LoggerFactory.getLogger(TopicReceiveController.class);
175+
private final Logger logger = LoggerFactory.getLogger(TopicReceiveController.class);
176176

177177
@JmsListener(destination = TOPIC_NAME, containerFactory = "topicJmsListenerContainerFactory",
178178
subscription = SUBSCRIPTION_NAME)
179179
public void receiveMessage(User user) {
180-
LOGGER.info("Received message: {}", user.getName());
180+
logger.info("Received message: {}", user.getName());
181181
}
182182
}
183183
```

sdk/spring/azure-spring-boot/src/samples/java/com/azure/spring/jms/QueueReceiveController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ public class QueueReceiveController {
1818

1919
private static final String QUEUE_NAME = "<ServiceBusQueueName>";
2020

21-
private final Logger LOGGER = LoggerFactory.getLogger(QueueReceiveController.class);
21+
private final Logger logger = LoggerFactory.getLogger(QueueReceiveController.class);
2222

2323
@JmsListener(destination = QUEUE_NAME, containerFactory = "jmsListenerContainerFactory")
2424
public void receiveMessage(User user) {
25-
LOGGER.info("Received message: {}", user.getName());
25+
logger.info("Received message: {}", user.getName());
2626
}
2727
}

sdk/spring/azure-spring-boot/src/samples/java/com/azure/spring/jms/TopicReceiveController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ public class TopicReceiveController {
2020

2121
private static final String SUBSCRIPTION_NAME = "<ServiceBusSubscriptionName>";
2222

23-
private final Logger LOGGER = LoggerFactory.getLogger(TopicReceiveController.class);
23+
private final Logger logger = LoggerFactory.getLogger(TopicReceiveController.class);
2424

2525
@JmsListener(destination = TOPIC_NAME, containerFactory = "topicJmsListenerContainerFactory",
2626
subscription = SUBSCRIPTION_NAME)
2727
public void receiveMessage(User user) {
28-
LOGGER.info("Received message: {}", user.getName());
28+
logger.info("Received message: {}", user.getName());
2929
}
3030
}

0 commit comments

Comments
 (0)