Azure / Azure/Azure-Functions

AzureFunctionapp APPSETTING_ getting appended

Open
#1,357 0 comments 0 reactions 2 assignees Claimed by @jeffhollan View on GitHub
premium-plan
Dominant language
PowerShell
Stars
1.1k
Forks
215
Avg merge
4h 2m
Merged PRs (30d)
1

Description

** Issue details **
I have a .net core 2.0 Azure function app, and i have a Keyvault initializer code which fetches values from keyvault and assigns to a ConcurrentDictionary, the functionality works fine, but i see lot of dependency failures for each of the keyvault URI settings. My guess is APPSETTING_ is getting appended to each of the setting values. My code logic is reading all Environment variables and trying to find out what all settings contain Keyvault domain address, for those values i am making a call to Keyvault API to resolve the values.

**Expected behavior**
Dependecies errors shouldn't come.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Code**

var envVar = Environment.GetEnvironmentVariables(EnvironmentVariableTarget.Process);
var retryInstance = RetryHelper.Instance; SecretBundle secretBundle = new SecretBundle();
var keyVaultAddress = ConfigurationHelper.GetEnvironmentVariables("KeyVaultBaseUrl");

if (!string.IsNullOrWhiteSpace(keyVaultAddress))
{
foreach (string envKey in envVar.Keys)
{
string envValue = envVar[envKey].ToString();

//Check if previously the values have been added to the dictionary or not
if (envValue.Contains(Constants.VAULT) && envValue.Contains(Constants.HTTPS) && !KeyVaultValues.ContainsKey(envKey))
{
retryInstance.RetryAction( () =>
{
secretBundle = KeyVaultInitializer.GetValuesFromKeyvault(envKey,
keyVaultAddress).Result;
}, Constants.MAXRETRIES, Constants.WAITBETWEENRETRY, RetryHelper.BackOffStrategy.Linear);

if (secretBundle != null && secretBundle.Value != null )
KeyVaultValues.TryAdd(envKey, secretBundle.Value);
}
}
} else
{
//TODO: Log failure event
}

![image](https://user-images.githubusercontent.com/349954/66630227-6ee3a780-ec21-11e9-8f9a-9dc9469b8c2c.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.