Azure / Azure/Azure-Spring-Apps

Azure Spring Cloud Config Server integration with Azure Key Vault should be supported & documented.

Open
#9 2 comments 0 reactions 1 assignee Claimed by @hangwan97 View on GitHub
Enhancement Tracking Triaging
Dominant language
No language data
Stars
9
Forks
11
PR merge metrics
No merged PRs in 30d

Description

A basic strong requirement is to configure a DB connection string including password injected from Azure Key Vault.

Assuming we have the here yunder secrets stored in KV:
```sh
az keyvault secret set --vault-name ${KEY_VAULT} --name "MYSQL_SERVER_NAME" --value ${MYSQL_SERVER_NAME}
az keyvault secret set --vault-name ${KEY_VAULT} --name "MYSQL-SERVER-FULL-NAME" --value ${MYSQL_SERVER_FULL_NAME}
az keyvault secret set --vault-name ${KEY_VAULT} --name "MYSQL-SERVER-ADMIN-NAME" --value ${MYSQL_SERVER_ADMIN_NAME}
az keyvault secret set --vault-name ${KEY_VAULT} --name "MYSQL-SERVER-ADMIN-LOGIN-NAME" --value ${MYSQL_SERVER_ADMIN_LOGIN_NAME}
az keyvault secret set --vault-name ${KEY_VAULT} --name "MYSQL-SERVER-ADMIN-PASSWORD" --value ${MYSQL_SERVER_ADMIN_PASSWORD}
az keyvault secret set --vault-name ${KEY_VAULT} --name "MYSQL-DATABASE-NAME" --value ${MYSQL_DATABASE_NAME}
```

application.yml should look like:
```sh
spring:
cloud:
azure:
keyvault:
secret:
property-sources:
- credential:
client-id: ${AZURE_CLIENT_ID}
client-secret: ${AZURE_CLIENT_SECRET}
endpoint: ${ENDPOINT}
profile:
tenant-id: ${AZURE_TENANT_ID}
```

```sh
---
spring:
config:
activate:
on-profile: mysql
datasource:
schema: classpath*:db/mysql/schema.sql
data: classpath*:db/mysql/data.sql
url: jdbc:mysql://${MYSQL-SERVER-FULL-NAME}:3306/${MYSQL-DATABASE-NAME}?useSSL=true&requireSSL=true&enabledTLSProtocols=TLSv1.2&verifyServerCertificate=true

username: ${MYSQL-SERVER-ADMIN-LOGIN-NAME} # ${MYSQL_SERVER_ADMIN_LOGIN_NAME}
password: ${MYSQL-SERVER-ADMIN-PASSWORD} # ${MYSQL_SERVER_ADMIN_PASSWORD}
initialization-mode: NEVER # ALWAYS
platform: mysql
```

See Azure [KV SDK integration doc](https://microsoft.github.io/spring-cloud-azure/4.0.0/reference/html/index.html#advanced-usage).

See issue [https://github.com/MicrosoftDocs/azure-docs/issues/91311](https://github.com/MicrosoftDocs/azure-docs/issues/91311)

See issue [https://github.com/Azure/azure-sdk-for-java/issues/28128](https://github.com/Azure/azure-sdk-for-java/issues/28128)

---

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.