"
ASP.NET (snapshot 2017) Microsoft documentation and samplesThis sample illustrates the use of the Azure Key Vault Configuration Provider for ASP.NET Core 1.x. For the ASP.NET Core 2.x sample, see Key Vault Configuration Provider sample application (ASP.NET Core 2.x).
[!NOTE] The configuration provider isn’t available for ASP.NET Core 1.0. If you want to implement the configuration provider and the app is an ASP.NET Core 1.0 app, upgrade the app to 1.1 or later first.
For more information on how the sample works, see the (xref:)Azure Key Vault configuration provider topic.
--
(two dashes) as a separator in the sample. Colons, which are normally used to delimit a section from a subkey in (xref:)ASP.NET Core configuration, aren’t allowed in secret names. Therefore, two dashes are used and swapped for a colon when the secrets are loaded into the app’s configuration.SecretName
: secret_value_1
Section--SecretName
: secret_value_2
Set-AzureRmKeyVaultAccessPolicy
PowerShell cmdlet to authorize the app to access the key vault, provide List
and Get
access to secrets with -PermissionsToKeys list,get
.Vault
, ClientId
, and ClientSecret
.IConfigurationRoot
with the same name as the secret name.SecretName
is obtained with config["SecretName"]
.:
(colon) notation or the GetSection
extension method. Use either of these approaches to obtain the configuration value:
config["Section:SecretName"]
config.GetSection("Section")["SecretName"]