Dan
Dan

Reputation: 831

Azure Storage 400 on one WebServer but not dev or local

Connection to my Azure Storage Account on the Production App Services (WebSite) results in a 400 Error. Connecting to the same Azure Storage Account from local development box works correctly. Connection to the same Azure Storage Account from our Development App Service (Website) works correctly. The production server uses the Azure Key Vault for the connection setting and I have checked the value is being returned. I have intentionally modified the key vault value to ensure it was being used.

The following throughs a 400 Bad Request Error. There is no Inner Exception Message.


CloudStorageAccount storageAccount = CloudStorageAccount.Parse(_configuration.GetSection("AzureStorageConnection").GetSection("ConnectionString").Value);
CloudTableClient tableClients = storageAccount.CreateCloudTableClient();

Additional information: I have checked the Overview and the General Settings between the Development App Service and Production App Service. They match where appropriate. Something seems to wrong for this App Service. I have switched the look up from the keyvault to configuration file and that has worked. The issue seems to be with pulling the key value from the keyvault. I have compared the value stored in the keyvault to the app configuration to make sure they match.

Exception Returned:

The remote server returned an error: (400) Bad Request. 
Stack trace1: at Microsoft.Azure.Cosmos.Table.RestExecutor.TableCommand.Executor.ExecuteAsync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken callerCancellationToken) 
at Microsoft.Azure.Cosmos.Table.RestExecutor.TableCommand.Executor.<>c__DisplayClass0_0`1.<ExecuteSync>b__0() 
at Microsoft.Azure.Cosmos.Table.RestExecutor.Utils.RestUtility.RunWithoutSynchronizationContext[T](Func`1 actionToRun) 
at Microsoft.Azure.Cosmos.Table.RestExecutor.TableCommand.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) 
at Microsoft.Azure.Cosmos.Table.RestExecutor.TableRestExecutor.ExecuteTableOperation[TResult](TableOperation operation, CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext) 
at Microsoft.Azure.Cosmos.Table.TableOperation.Execute(CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext) 
at Microsoft.Azure.Cosmos.Table.CloudTable.Create(TableRequestOptions requestOptions, OperationContext operationContext, String serializedIndexingPolicy, Nullable`1 throughput, Nullable`1 defaultTimeToLive) 
at Microsoft.Azure.Cosmos.Table.CloudTable.CreateIfNotExists(TableRequestOptions requestOptions, OperationContext operationContext, String serializedIndexingPolicy, Nullable`1 throughput, Nullable`1 defaultTimeToLive) 
at Esperanto.Manager.Services.AzureTableStorageManagement.ReadAllEntity() in /home/vsts/work/1/s/MyCode/AzureTableStorageManagement.cs:line 199

Please note originally only one line of code was shown because it was the line mentioned in the stacktrace but it may be the line that is immediately after. This has been included.

Upvotes: 0

Views: 128

Answers (1)

Dan
Dan

Reputation: 831

The issue was resolved by rebuilding the azure website. Something was stuck or cached. Sorry this is not a better answer.

Upvotes: 0

Related Questions