Getting UnknownHostException while accessing key-vault secrets

Viewed 774

We have a spring boot application deployed in Azure App Service that access Azure Key Vault using Service Principle. Below are the steps we used

  1. Created a Service Principal (SP) and Key-vault
  2. Stored the SP’s client secret into Key-Vault
  3. Provided necessary access(Get, List, Set permissions in Secret Permissions section) to SP to access Key-Vault
  4. Also, we added VNet and to Data lake storage account and provided necessary access to SP to access storage as well.
  5. Whitelisted IP of the App Service in Key-Vault also.
  6. Deployed the spring boot app in Azure App service

After deployment service is up and running perfectly but suddenly sometime we are getting below error and we cant access the hosted web services because of the below error container keep on restarting in Azure.

2020-10-08 09:59:53,945 ERROR o.s.b.SpringApplication - Application run failed 
java.lang.IllegalStateException: Failed to configure KeyVault property source 
        at com.microsoft.azure.keyvault.spring.KeyVaultEnvironmentPostProcessorHelper.addKeyVaultPropertySource(KeyVaultEnvironmentPostProcessorHelper.java:77) ~[azure-spring
-boot-2.2.4.jar!/:?] 
Caused by: java.lang.RuntimeException: Max retries 3 times exceeded. Error Details: keyvault-name.vault.azure.net 
  
Caused by: java.net.UnknownHostException: keyvault-name.vault.azure.net

After 2-3 hours it automatically gets resolved. We are not able to replicate the issue since its intermittent and we don't know the pattern. Can any one guide us where and what will be the issue.

0 Answers
Related