Install https://github.com/Microsoft/artifacts-credprovider
Add a nuget.config file to your project, in the same folder as your .csproj or .sln file. E.g.:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
| #!/bin/bash | |
| set -euo pipefail | |
| IFS=$'\n\t' | |
| # -e: immediately exit if any command has a non-zero exit status | |
| # -o: prevents errors in a pipeline from being masked | |
| # IFS new value is less likely to cause confusing bugs when looping arrays or arguments (e.g. $@) | |
| function usage() | |
| { |
Install https://github.com/Microsoft/artifacts-credprovider
Add a nuget.config file to your project, in the same folder as your .csproj or .sln file. E.g.:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
| public static class ServiceExtensions | |
| { | |
| public static IServiceCollection AddTypedHttpClient(this IServiceCollection service, IConfiguration configuration) | |
| { | |
| service.Configure<HttpClientConfiguration>( | |
| configuration.GetSection(nameof(HttpClientConfiguration))); | |
| var provider = service.BuildServiceProvider(); | |
| var httpConfiguration = provider.GetService<IOptions<HttpClientConfiguration>>().Value; |
| configurationBuilder.AddAzureKeyVault(new AzureKeyVaultConfigurationOptions | |
| { | |
| Vault = configuration["KeyVaultUrl"], | |
| ReloadInterval = TimeSpan.FromMinutes(10), | |
| Client = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback( | |
| new AzureServiceTokenProvider().KeyVaultTokenCallback)) | |
| }); |
| using Microsoft.Azure.KeyVault.Models; | |
| using Microsoft.Extensions.Configuration; | |
| using Microsoft.Extensions.Configuration.AzureKeyVault; | |
| namespace Demo.Azure.KeyVault | |
| { | |
| public class PrefixKeyVaultSecretManager : IKeyVaultSecretManager | |
| { | |
| private readonly string _prefix; |
| [FunctionName("SbusQueueTriggerFunction")] | |
| public async Task RunAsync( | |
| [ServiceBusTrigger("%QueueName%", Connection = "SbusConnectionString")] | |
| Message message, | |
| MessageReceiver messageReceiver, | |
| ILogger log) | |
| { | |
| // ... | |
| // dead-letter the msg |