# AzureKeyVaultResource

- Kind: `class`
- Package: [Aspire.Hosting.Azure.KeyVault](/reference/api/csharp/aspire.hosting.azure.keyvault.md)
- Version: `13.4.0`
- Namespace: `Aspire.Hosting.Azure`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResource.cs)
- Inherits: `AzureProvisioningResource`
- Implements: `IAzureResource`, `IExpressionValue`, `IManifestExpressionProvider`, `IResource`, `IResourceWithConnectionString`, `IResourceWithEndpoints`, `IValueProvider`, `IValueWithReferences`, `IAzureKeyVaultResource`, `IAzureNspAssociationTarget`, `IAzurePrivateEndpointTarget`

A resource that represents an Azure Key Vault.

## Definition

```csharp
namespace Aspire.Hosting.Azure;

public class AzureKeyVaultResource
    : Aspire.Hosting.Azure.AzureProvisioningResource,
      Aspire.Hosting.ApplicationModel.IAzureResource,
      Aspire.Hosting.ApplicationModel.IExpressionValue,
      Aspire.Hosting.ApplicationModel.IManifestExpressionProvider,
      Aspire.Hosting.ApplicationModel.IResource,
      Aspire.Hosting.ApplicationModel.IResourceWithConnectionString,
      Aspire.Hosting.ApplicationModel.IResourceWithEndpoints,
      Aspire.Hosting.ApplicationModel.IValueProvider,
      Aspire.Hosting.ApplicationModel.IValueWithReferences,
      Aspire.Hosting.Azure.IAzureKeyVaultResource,
      Aspire.Hosting.Azure.IAzureNspAssociationTarget,
      Aspire.Hosting.Azure.IAzurePrivateEndpointTarget
{
    // ...
}
```

## Constructors

- [AzureKeyVaultResource(string, Action<AzureResourceInfrastructure>)](/reference/api/csharp/aspire.hosting.azure.keyvault/azurekeyvaultresource/constructors.md#constructor-string-action-azureresourceinfrastructure) -- A resource that represents an Azure Key Vault.

## Properties

- [ConnectionStringExpression](/reference/api/csharp/aspire.hosting.azure.keyvault/azurekeyvaultresource/properties.md#connectionstringexpression) : `ReferenceExpression` `get` -- Gets the connection string template for the manifest for the Azure Key Vault resource.
- [Id](/reference/api/csharp/aspire.hosting.azure.keyvault/azurekeyvaultresource/properties.md#id) : `BicepOutputReference` `get` -- Gets the "id" output reference for the Azure Key Vault resource.
- [IsEmulator](/reference/api/csharp/aspire.hosting.azure.keyvault/azurekeyvaultresource/properties.md#isemulator) : `bool` `get` -- Gets a value indicating whether the Azure Key Vault resource is running in the local emulator.
- [NameOutputReference](/reference/api/csharp/aspire.hosting.azure.keyvault/azurekeyvaultresource/properties.md#nameoutputreference) : `BicepOutputReference` `get` -- Gets the "name" output reference for the Azure Key Vault resource.
- [UriExpression](/reference/api/csharp/aspire.hosting.azure.keyvault/azurekeyvaultresource/properties.md#uriexpression) : `ReferenceExpression` `get` -- Gets the endpoint URI expression for the Key Vault resource.
- [VaultUri](/reference/api/csharp/aspire.hosting.azure.keyvault/azurekeyvaultresource/properties.md#vaulturi) : `BicepOutputReference` `get` -- Gets the "vaultUri" output reference for the Azure Key Vault resource.

## Methods

- [AddAsExistingResource(AzureResourceInfrastructure)](/reference/api/csharp/aspire.hosting.azure.keyvault/azurekeyvaultresource/methods.md#addasexistingresource-azureresourceinfrastructure) : `ProvisionableResource`
- [GetConnectionStringAsync(CancellationToken)](/reference/api/csharp/aspire.hosting.azure.keyvault/azurekeyvaultresource/methods.md#getconnectionstringasync-cancellationtoken) : `ValueTask<string?>` -- Gets the connection string for the Azure Key Vault resource.
- [GetSecret(string)](/reference/api/csharp/aspire.hosting.azure.keyvault/azurekeyvaultresource/methods.md#getsecret-string) : `IAzureKeyVaultSecretReference` -- Gets a secret reference for the specified secret name.
