使用MSI从Java应用程序连接到Azure KeyVault

时间:2019-04-05 10:14:09

标签: java

当我在Java中使用“ AppServiceMSICredentials”连接到Azure Keyvault时。我正在

错误

  

java.net.ConnectException:连接被拒绝:connect

代码段:

AppServiceMSICredentials appServiceMsiCredentials = new AppServiceMSICredentials(AzureEnvironment.AZURE,"XXXXXXXXXXXXXXXX","XXXXXXXXXXXXXXXXX"); appServiceMsiCredentials.withDefaultSubscriptionId(subscriptionId);

KeyVaultClient keyVaultClient = new KeyVaultClient(appServiceMsiCredentials);

PagedList list = keyVaultClient.listSecrets("X");

for (SecretItem listItem : list) { System.out.println(listItem.id()); }

0 个答案:

没有答案