title: Azure Storage : Unable to access Container blobs with defined Credentials
body: <p>We are setting a Key for the Storage Account and then using to access the contents as below;</p>
  <pre><code>var storageCredentials = new StorageCredentials(mediaStorageAccountName, base64EncodedKey);
  var storageAccount = new CloudStorageAccount(storageCredentials, true);
  var connString = storageAccount.ToString(true);
  </code></pre>
  <p>Then, using the same &quot;storageAccount&quot; to create the Blob Client;</p>
  <pre><code>CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
  </code></pre>
  <p>And to get the Container;</p>
  <pre><code>var container = blobClient.GetContainerReference(ContainerName);
  </code></pre>
  <p>&quot;storageAccount&quot; Credential properties are &quot;IsSAS&quot; FALSE, &quot;IsSharedKey&quot; TRUE, &quot;IsToken&quot; FALSE and &quot;KeyName&quot; is NULL.</p>
  <p>But, when Blob is being accessed with OpenReadAsync, its failing with following exception;</p>
  <blockquote>
  <p>The remote server returned an error: (403) Forbidden.,The remote server returned an error: (403) Forbidden. Line number: Microsoft.WindowsAzure.Storage Trace:    at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndExecuteAsync[T](IAsyncResult result)
  at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.EndExists(IAsyncResult asyncResult)
  at Microsoft.WindowsAzure.Storage.Core.Util.AsyncExtensions.&lt;&gt;c__DisplayClass2`1.b__0(IAsyncResult ar)</p>
  </blockquote>
  <p>It is basically getting all the references to Container/Blobs etc correctly (gives correct name), but when its tried to read/download/upload those, it fails.</p>
  <p>Also, instead of using the &quot;storageAccount&quot; reference directly, even if it is secured with following, it gives same exception;</p>
  <pre><code>CloudStorageAccount storageAccount = new CloudStorageAccount(
     new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials(storageAccountName, base64EncodedKey), true);
  </code></pre>
  <p>What is wrong here and how to fix this?
  Why is KeyName NULL? Is that causing this issue?</p>