-
Notifications
You must be signed in to change notification settings - Fork 400
/
AzureSecurityKeyVaultSettings.cs
51 lines (44 loc) · 1.93 KB
/
AzureSecurityKeyVaultSettings.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Aspire.Azure.Common;
using Azure.Core;
using Azure.Security.KeyVault.Secrets;
namespace Aspire.Azure.Security.KeyVault;
/// <summary>
/// Provides the client configuration settings for connecting to Azure Key Vault.
/// </summary>
public sealed class AzureSecurityKeyVaultSettings : IConnectionStringSettings
{
/// <summary>
/// A <see cref="Uri"/> to the vault on which the client operates. Appears as "DNS Name" in the Azure portal.
/// If you have a secret <see cref="Uri"/>, use <see cref="KeyVaultSecretIdentifier"/> to parse the <see cref="KeyVaultSecretIdentifier.VaultUri"/> and other information.
/// You should validate that this URI references a valid Key Vault resource. See <see href="https://aka.ms/azsdk/blog/vault-uri"/> for details.
/// </summary>
public Uri? VaultUri { get; set; }
/// <summary>
/// Gets or sets the credential used to authenticate to the Azure Key Vault.
/// </summary>
public TokenCredential? Credential { get; set; }
/// <summary>
/// Gets or sets a boolean value that indicates whether the Key Vault health check is disabled or not.
/// </summary>
/// <value>
/// The default value is <see langword="false"/>.
/// </value>
public bool DisableHealthChecks { get; set; }
/// <summary>
/// Gets or sets a boolean value that indicates whether the OpenTelemetry tracing is disabled or not.
/// </summary>
/// <value>
/// The default value is <see langword="false"/>.
/// </value>
public bool DisableTracing { get; set; }
void IConnectionStringSettings.ParseConnectionString(string? connectionString)
{
if (!string.IsNullOrEmpty(connectionString) &&
Uri.TryCreate(connectionString, UriKind.Absolute, out var uri))
{
VaultUri = uri;
}
}
}