Подключите SecretClient к проксиму
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;
Tired Tern