Search code examples
javaazureazure-java-sdkazure-identity

Managed Identity Authentication from non Azure VM


I would like to access from a Java application to an Azure Key Vault.I would like to use Managed Authentication. If I understand correctly this solution is only available using VM on Azure and is not possible on a server outside the Microsoft environment. In this case I would have to proceed with access via clientId, tenantId and secret using ClientSecretCredential. Did I understand correctly or is it possible to use Managed Identity Authentication also on machines outside Azure?

Here some sources: https://github.com/Azure/azure-sdk-for-java/blob/azure-storage-blob_12.16.1/sdk/identity/azure-identity/README.md#authenticating-service-principals

https://github.com/Azure/azure-sdk-for-java/wiki/Azure-Identity-Examples#authenticating-in-azure-with-managed-identity


Solution

  • In this case I would have to proceed with access via clientId, tenantId and secret using ClientSecretCredential. Did I understand correctly or is it possible to use Managed Identity Authentication also on machines outside Azure?

    Yes, you will still need environment variables like clientID, tentantID and SecretClient with DefaultAzureCredential and EnvironmentCredential.

    For example, you can refer to this blog and answer on how to use Azure Managed Identity to access resources of other cloud provider.