AzureProvisioningResourceExtensions.AsKeyVaultSecret Method

Definition

Gets or creates a KeyVaultSecret resource in the specified AzureResourceInfrastructure for the given IAzureKeyVaultSecretReference.

If the referenced Key Vault or secret does not already exist in the infrastructure, they will be created and added. This allows referencing secrets that are provisioned outside of the current deployment.

public static Azure.Provisioning.KeyVault.KeyVaultSecret AsKeyVaultSecret(this Aspire.Hosting.Azure.IAzureKeyVaultSecretReference secretReference, Aspire.Hosting.Azure.AzureResourceInfrastructure infrastructure);
static member AsKeyVaultSecret : Aspire.Hosting.Azure.IAzureKeyVaultSecretReference * Aspire.Hosting.Azure.AzureResourceInfrastructure -> Azure.Provisioning.KeyVault.KeyVaultSecret
<Extension()>
Public Function AsKeyVaultSecret (secretReference As IAzureKeyVaultSecretReference, infrastructure As AzureResourceInfrastructure) As KeyVaultSecret

Parameters

secretReference
IAzureKeyVaultSecretReference

The IAzureKeyVaultSecretReference representing the Key Vault secret to reference.

infrastructure
AzureResourceInfrastructure

The AzureResourceInfrastructure in which to locate or add the KeyVaultSecret.

Returns

The KeyVaultSecret instance corresponding to the given secret reference.

Applies to