7

I am going use key vault for Azure Function App.

I am using .NET SDK.

  1. Azure.Security.KeyVault.Secrets
  2. Azure.Identity

Example:

string keyVaultUrl = configuration["KeyVaultSettings:Url"];

            TokenCredential credential = new DefaultAzureCredential();
#if DEBUG
            credential = new ClientSecretCredential(configuration["AZURE_TENANT_ID"],
                                                    configuration["AZURE_CLIENT_ID"],
                                                    configuration["AZURE_CLIENT_SECRET"]);
#endif

            var secretClient = new SecretClient(new Uri(keyVaultUrl), credential);

To debug locally I need

tenant_id, client_id, and client_secret.

How Can i get this?

Rakesh Kumar
  • 2,701
  • 9
  • 38
  • 66
  • Refer this [link] (https://learn.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal#get-tenant-and-app-id-values-for-signing-in) to get tenant_id, client_id. However you cannot retrieve client_secret from portal. You can try by creating a new client_secret – Hemant Halwai Sep 07 '20 at 11:20

1 Answers1

3

I assume you have Authentication turned on in your Function App. Go to App Registration of the function app and for steps to fetch Client Id, Tenant Id and Client Secret, you can refer this and this.

Harshita Singh
  • 4,590
  • 1
  • 10
  • 13