title: Can't read value from Azure Key Vault
body: <p>I've implmented Azure Key Vault in my Azure Functions app following this article:
  <a href="https://medium.com/statuscode/getting-key-vault-secrets-in-azure-functions-37620fd20a0b" rel="nofollow noreferrer">https://medium.com/statuscode/getting-key-vault-secrets-in-azure-functions-37620fd20a0b</a></p>
  
  <p>As described in the article, I'm using Managed Service Identity (MSI) but looks like I'm unable to read values from Key Vault. The following is the line that is supposed to read the value.</p>
  
  <pre><code>var myValue = (await kvClient.GetSecretAsync(Environment.GetEnvironmentVariable("documentDbkey"))).Value;
  </code></pre>
  
  <p>This is what my entries look like on Azure KeyVault:
  <a href="https://i.stack.imgur.com/JsgyX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JsgyX.png" alt="enter image description here"></a></p>
  
  <p>Am I supposed to use the <code>key</code> for my entry i.e. <code>documentDb</code> or the version Id which is the one that starts with <code>bf2550f4e</code>?</p>
  
  <p>Here's error:</p>
  
  <blockquote>
    <p>Exception while executing function: IngridNotificationsFunction
    Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception
    while executing function: IngridNotificationsFunction --->
    System.ArgumentNullException : Value cannot be null. Parameter name:
    secretIdentifier    at async
    Microsoft.Azure.KeyVault.KeyVaultClientExtensions.GetSecretAsync(??)<br>
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()<br>
    at async Ingrid.Notifications.IngridNotifications.Initialize() at
    C:\Users\Sam\Documents\Visual Studio
    2017\Projects\Ingrid.Notifications\Ingrid.Notifications\IngridNotifications.cs
    : 83    at
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at
    async Ingrid.Notifications.IngridNotifications.Run(String myQueueItem)
    at C:\Users\Sam\Documents\Visual Studio
    2017\Projects\Ingrid.Notifications\Ingrid.Notifications\IngridNotifications.cs
    : 38    at
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at
    async
    Microsoft.Azure.WebJobs.Host.Executors.VoidTaskMethodInvoker<code>2.InvokeAsync[TReflected,TReturnType](TReflected
    instance,Object[] arguments) at
    C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\VoidTaskMethodInvoker.cs
    : 20    at
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at
    async
    Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker</code>2.InvokeAsync[TReflected,TReturnValue](Object
    instance,Object[] arguments) at
    C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs
    : 63    at
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at
    async
    Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeAsync(IFunctionInvoker
    invoker,ParameterHelper parameterHelper,CancellationTokenSource
    timeoutTokenSource,CancellationTokenSource
    functionCancellationTokenSource,Boolean throwOnTimeout,TimeSpan
    timerInterval,IFunctionInstance instance) at
    C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Hos…</p>
  </blockquote>
  
  <p>What could be the reason why I'm unable to read values from my Azure KeyVault?</p>