title: azure storage emulator (Table) returns 400 bad request or 403 forbidden
body: <p>Question: What am I missing to access azure development table storage?</p>
  
  <p>Note: I can access my azure CLOUD storage (using different code of course), but I am failing when trying to access the development storage.</p>
  
  <p>I'm using:</p>
  
  <ul>
  <li>Visual Studio 2012 </li>
  <li>.Net Framework 4.0 C# library</li>
  <li>NuGet Widows Azure Storage v6.0   <strong>&lt;== CORRECTION - Using v6.1.0.0</strong></li>
  <li>Microsoft Azure SDK for .net 2.6 </li>
  <li><p>Microsoft Azure Storage Emulator v4.0 <strong>&lt;- changing to v4.2 fixed issue</strong></p>
  
  <pre><code>var cloudStorageAccount = CloudStorageAccount.DevelopmentStorageAccount;
  
  var tableClient = cloudStorageAccount.CreateCloudTableClient();
  var table = tableClient.GetTableReference("MYTEMPTABLE");
  var iscreated = table.CreateIfNotExists();
  </code></pre>
  
  <p>The last statement gives this exception</p>
  
  <pre><code>The remote server returned an error: (400) Bad Request.
  The value for one of the HTTP headers is not in the correct format.
  RequestId:f0b37575-30f4-45c1-bec3-2620c3c605e7
  Time:2015-11-04T16:12:37.4719620Z
  </code></pre></li>
  </ul>
  
  <p>StackTrace</p>
  
  <pre><code>    at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Executor\Executor.cs:line 816
      at Microsoft.WindowsAzure.Storage.Table.TableOperation.Execute(CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Table\TableOperation.cs:line 41
      at Microsoft.WindowsAzure.Storage.Table.CloudTable.Exists(Boolean primaryOnly, TableRequestOptions requestOptions, OperationContext operationContext) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Table\CloudTable.cs:line 1605
      at Microsoft.WindowsAzure.Storage.Table.CloudTable.CreateIfNotExists(TableRequestOptions requestOptions, OperationContext operationContext) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Table\CloudTable.cs:line 1024
      at USPS.Cloud.Integration.AspProviders.UspsReturnsStorageBase.CreateStorageAccountFromConnectionString() in ... &lt;my local code call stack&gt;
  </code></pre>
  
  <p>FYI: In searching MSDN, StackOverflow, etc, I've found 3 ways to get a CloudStorageAccount object to access the storage emulator.  The first 2 give the error above.  The 3rd gives a 403 error.</p>
  
  <hr>
  
  <pre><code>CloudStorageAccount = CloudStorageAccount.DevelopmentStorageAccount;
  </code></pre>
  
  <hr>
  
  <pre><code>CloudStorageAccount = CloudStorageAccount.Parse("UseDevelopmentStorage=true");
  </code></pre>
  
  <hr>
  
  <pre><code>var devAccountName = "devstoreaccount1";
  var devAccountKey = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==";
  var devCredentials = new StorageCredentials(devAccountName, devAccountKey);
  var cloudStorageAccount = new CloudStorageAccount(devCredentials, true);
  </code></pre>
  
  <p><strong><em>UPDATE</em></strong> </p>
  
  <p>As stated in the answer, I did not have the correct emulator version.
  Dev storage connections 1 &amp; 2 above work.  Following the link in the answer by @Emily Gerner - MSFT led me to this for a working option 3. </p>
  
  <pre><code>var devConnectionString = "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;";
  CloudStorageAccount = CloudStorageAccount.Parse(devConnectionString);
  </code></pre>