Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Connect secretclient to proxy

using Azure.Extensions.AspNetCore.Configuration.Secrets; // v1.2.1
using Azure.Identity; // v1.5.0
using Azure.Security.KeyVault.Secrets; // v4.3.0-beta.4

var builder = WebApplication.CreateBuilder(args);

var webProxy = new WebProxy(new Uri("{proxy_url}")) { 
    Credentials = CredentialCache.DefaultNetworkCredentials 
};

var httpClient = new HttpClient(new HttpClientHandler { 
    Proxy = kpmgWebProxy, SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls 
});

var secretClientOptions = new SecretClientOptions { 
    Transport = new HttpClientTransport(httpClient) 
}; 

// `Azure.Security.KeyVault.Secrets` package version < 4.3.0 does not have the tenant discovery feature, therefore you will have to set this i nthe options. 
/*var defaultAzureCredentialOptions = new DefaultAzureCredentialOptions()
{
    VisualStudioTenantId = "",
};*/

var secretClient = new SecretClient(
    new Uri(azureKeyVaultUrl), 
    new DefaultAzureCredential(/*defaultAzureCredentialOptions*/), 
    secretClientOptions);

builder.Configuration
    .AddAzureKeyVault(secretClient, new KeyVaultSecretManager());

var output = builder.Configuration
    .GetSection("ApplicationInsights:InstrumentationKey").Value;
Comment

PREVIOUS NEXT
Code Example
Csharp :: Adding number of day remaining to future date from now 
Csharp :: Unity FPS camera z axis rotating problem 
Csharp :: get the next letter after specific character in c# 
Csharp :: get path revit link unloaded 
Csharp :: c# load a file into binary buffer 
Csharp :: c# how to load type of class from string 
Csharp :: c# variables 
Csharp :: c# .net core 3.0 trying Exception The transaction log for database is full due to ACTIVE_TRANSACTION 
Csharp :: parallelism in c# 
Csharp :: windows forms add onclick 
Csharp :: stackoverflow array c# 
Csharp :: c# find the smallest string in an array of strings 
Csharp :: NetConnectionDispatch 
Csharp :: revision1 
Csharp :: my object is falling unity 
Csharp :: c# initialize event 
Csharp :: unity sprite blurry when far 
Csharp :: how to open or close combobox in c# 
Csharp :: C# Custom setter with parameter 
Csharp :: moment script unity 
Csharp :: EntityFramework: using tables in different scemas 
Csharp :: c# prototype function 
Csharp :: how to download things c# 
Csharp :: Connect To MongoDB From A Different Machine 
Csharp :: C:UsersSherryDocumentssdata.dta 
Csharp :: C# Blocks without statements 
Csharp :: An unhandled exception occurred during the execution of the current web request 
Csharp :: How to make a capsule walk in unity 
Csharp :: .net core best package for scheduler 
Csharp :: c# check if there is 5 mins space between two datestime 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =