Windows Azure key vault ad authentication fails for some projects
<p>We are using azure key vault for our azure storage blob encryption. <a href="https://azure.microsoft.com/en-us/documentation/articles/storage-encrypt-decrypt-blobs-key-vault/" rel="nofollow">This</a> is the tutorial I followed to get this to work.</p>

<p>I developed a sample application and a wrapper library for encrypting blobs. It all worked well in the sample application. But in the actual software after referencing the wrapper project when the app request the token an exception occurs,</p>

<pre><code>    private async Task&lt;string&gt; GetToken(string authority, string resource, string scope)
    {
        var authContext = new AuthenticationContext(authority);

        ClientCredential clientCred = new ClientCredential(ADClientID, ADClientSecret);
        AuthenticationResult result = await authContext.AcquireTokenAsync(resource, clientCred);

        if (result == null)
            throw new InvalidOperationException("Failed to obtain the JWT token");

        return result.AccessToken;
    }
</code></pre>

<p>In the above code at the line</p>

<pre><code>        var authContext = new AuthenticationContext(authority);
</code></pre>

<p>The exception it returns is</p>

<pre><code>InnerException = {"Couldn't find type for class Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35."}
</code></pre>

<p>What am I doing wrong?</p>