I have enabled the System generated Managed Service Identity for my Azure Linux server and I have also granted this VM access to a Key Vault. I have verified this is working by using curl on the command line to retrieve a token, then use the token to retrieve a secret from the vault.
I need to perform this same task in my Java program but the current way I am doing is is blocking. Here is my code lifted from another Stackoverflow post:
LOGGER.debug("Getting credentials through Managed Service Identity");
AppServiceMSICredentials credentials = new AppServiceMSICredentials(AzureEnvironment.AZURE);
LOGGER.debug("Credentials acquired");
KeyVaultClient keyVaultClient = new KeyVaultClient(credentials);
LOGGER.debug("Key Vault client created");
The code blocks on the line trying to acquire the credentials so all I see in the log is "Getting credentials through Managed Service Identity".
Is this the correct way to get the credentials? If so, any idea why this line is blocking?