简体   繁体   English

无法使用 Spring Boot 连接到 Key Vault

[英]Unable to connect to key vault using spring boot

I am following this part in the tutorial for integrating key vault with spring boot.我正在关注将密钥保管库与 Spring Boot 集成的教程中的这一部分

We have everything setup for using Managed identities (application.properties and dependency in pom) and since it doesn't run in local development, I am testing it by deployment, however I am getting these errors in the log stream:我们已经为使用托管身份(pom 中的 application.properties 和依赖项)进行了所有设置,并且由于它不在本地开发中运行,因此我正在通过部署对其进行测试,但是我在日志流中收到这些错误:

java.io.FileNotFoundException:/home/tomcat/lib/azure.appservice.jar (No such file or directory)

and

java.lang.IllegalStateException: Failed to configure KeyVault property source

java.io.IOException: Server returned HTTP response code: 400 for URL: Http://xxx.xx.xxx

EDIT: turned out I had a typo error in the client-id property.编辑:原来我在 client-id 属性中有一个错字错误。

make sure the application has permissions to get and list secrets in access policies of your key vault and also check the jar files are added properly.确保应用程序有权在密钥保管库的访问策略中获取和列出机密,并检查是否正确添加了 jar 文件。

Edit the src/main/resources/application.properties file so that it has the following contents, adjusting the values for your Azure subscription.c编辑src/main/resources/application.properties文件,使其具有以下内容,调整 Azure 订阅的值。c

azure.keyvault.client-id=<your client ID>
azure.keyvault.client-key=<your client key>
azure.keyvault.enabled=true
azure.keyvault.tenant-id=<your tenant ID>
azure.keyvault.uri=https://contosokv.vault.azure.net/

在此处输入图片说明

After adding azure.keyvault.tenant-id=<your-tenant-id> in the file:在文件中添加azure.keyvault.tenant-id=<your-tenant-id>后:

在此处输入图片说明

For more details refer this document and follow this Github code有关更多详细信息,请参阅此文档并遵循此Github代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM