Search code examples
azureazure-keyvaultazure-managed-identity

Azure KeyVaultClient Secret for GetKey


I have this code snippet:

enter image description here

I need to get the parameters:

keyIdentifier is easy enough:

enter image description here

clientId is also easy to find:

enter image description here

clientSecret - where do I get this??


Solution

  • Your screenshot is of a Managed Identity, there is no client secret that you can use. It uses certificates internally, but that is not really relevant here.

    My recommendation would be to use the Azure.Identity library to acquire tokens with DefaultAzureCredential. And also use the newer KeyVault libraries e.g.:

    DefaultAzureCredential can use a system-assigned Managed Identity automatically and your user account in local development environments. It tries multiple approaches and uses the one that works.