Can I use user principal to access Azure key vault from On-prem ?

Crazyhead 0 Reputation points
2023-08-10T18:13:13.1+00:00

Hi,

Can we use user principal to access Azure key vault programmatically from on-prem? we have a specific usecase that requires storing service principal credentials in the Azure key vault but the app needs to connect from on-prem.

Thanks!

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,451 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Vahid Ghafarpour 23,385 Reputation points Volunteer Moderator
    2023-08-10T18:17:22.98+00:00

    You can use key vault libraries depending on your technology

    https://learn.microsoft.com/en-us/azure/key-vault/general/client-libraries

    Keep in mind to set policies.

    • Configure an access policy in the Azure Key Vault that allows the User Principal's Managed Identity to access the necessary secrets.
    • This access policy should include permissions like Get and List.

  2. TP 125.8K Reputation points Volunteer Moderator
    2023-08-10T18:18:15.0566667+00:00

    Hi,

    Yes, you can access Azure Key Vault from on premises, provided the networking settings on the vault permit it.

    Please click Accept Answer if the above was useful.

    Thanks.

    -TP


  3. James Hamil 27,221 Reputation points Microsoft Employee Moderator
    2023-08-10T20:39:17.93+00:00

    Hi @Crazyhead , yes, this should work. You need to register an application with AAD and then authorize the application to access the key or secret in the vault using the az keyvault set-policy command. You can then use the appropriate SDK or REST API to access the Key Vault from your on-premises application. Make sure to use proper authentication methods like DefaultAzureCredential class provided by the Azure Identity client library for passwordless connections to Azure services.

    Please let me know if you have any questions and I can help you further.

    If this answer helps you please mark "Accept Answer" so other users can reference it.

    Thank you,

    James


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.