首页 > 解决方案 > Azure keyvault 值未进入我的代码

问题描述

我正在尝试从 azure 获取 keyvault 值。我已经使用下面提到的步骤来获取密钥。Crypto 进展顺利,但在 KeyVault 部分却没有。

string key = KeyVault.GetValueByKey(Crypto.GetDecryptedValue(WebConfigurationManager.LicenseKey))

我以 ThumbPrint 形式给出的 Liensekey 值。

public static string GetValueByKey(string key)
{
    string value = string.Empty;

    try
    {
        if (secrets.ContainsKey(key) == false)
        {
            value = KeyVault.GetSecret(key);

            secrets.Add(key, value); //Caching
        }
        else
        {
            value = secrets[key];
        }

    }
    catch (Exception Ex)
    {
        new CustomException("Failed to retrieve the value from keyvalult for key:'" + key + "'", Ex);
    }

value = KeyVault.GetSecret(key);一步一步失败了。任何人都可以在这方面帮助我。

标签: c#

解决方案


推荐阅读