Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add secrets sample #760

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ terraform -chdir=./terraform destroy -auto-approve
terraform -chdir=terraform destroy -auto-approve
```

## (Optional) Retrieve specific secrets

If you don't want to load all secrets from Azure Key Vault. You can specify the secrets you want to load by setting the `spring.cloud.azure.keyvault.secret.property-sources.secret-keys=secret1,secret2...` property in the `application.yaml` file.

For this sample, run locally with the command `mvn clean spring-boot:run -Dspring-boot.run.profiles=secrets` to activate the [application-secrets.yml](./src/main/resources/application-secrets.yml) profile file.

[Verify This Sample](#verify-this-sample).

## Deploy to Azure Spring Apps

Now that you have the Spring Boot application running locally, it's time to move it to production. [Azure Spring Apps](https://learn.microsoft.com/azure/spring-apps/overview) makes it easy to deploy Spring Boot applications to Azure without any code changes. The service manages the infrastructure of Spring applications so developers can focus on their code. Azure Spring Apps provides lifecycle management using comprehensive monitoring and diagnostics, configuration management, service discovery, CI/CD integration, blue-green deployments, and more. To deploy your application to Azure Spring Apps, see [Deploy your first application to Azure Spring Apps](https://learn.microsoft.com/azure/spring-apps/quickstart?tabs=Azure-CLI).
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
spring:
cloud:
azure:
keyvault:
secret:
property-sources[0]:
endpoint: ${ENDPOINT_1}
secret-keys:
- sampleProperty1
- samplePropertyInMultipleKeyVault
property-sources[1]:
endpoint: ${ENDPOINT_2}
secret-keys:
- sampleProperty2
Loading