0

I am doing like this :

   ClientSecretCredential cred = new ClientSecretCredential(TenantId, ClientId, ClientSecret);
   SecretClient client = new SecretClient(vaultUri: new Uri(KeyValutURL), cred);
   string ConnectionString = client.GetSecret(ColumnInfoSecretName).Value.Value;

Here I am getting connection string with ClientSecret but I want to get secret without using clientsecret.

  • What are you running your app on? Managed Identities are a good option if that is supported in the platform. – juunas Sep 15 '22 at 06:42
  • I am doing it on .Net Core MVC and I am trying with DefaultAzureCredential but it shows this type of error "DefaultAzureCredential failed to retrieve a token". – parth patel Sep 15 '22 at 06:56
  • Yeah but are you running it locally or on Azure App Service or on Azure Kubernetes Service or something else? – juunas Sep 15 '22 at 08:06
  • We are using Azure App Service. – parth patel Sep 15 '22 at 09:24

1 Answers1

2

You would need some kind of credentials to connect to and get data from an Azure KeyVault. ClientSecretCredential is one of the available credentials.

For the list of all available credentials, please see this link: https://learn.microsoft.com/en-us/dotnet/api/azure.core.tokencredential?view=azure-dotnet

enter image description here

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241