I was provided with an Azure table store SAS token with read-only access. I'm able to browse it using Azure Storage Explorer without issues. In trying to access it through a console app, I'm able to parse the connection string with the SAS token as a TableEndpoint but when I try and create the Table Client I get:
System.InvalidOperationException: No credentials provided. at Microsoft.WindowsAzure.Storage.CloudStorageAccount.CreateCloudTableClient()
This syntax I used for the connection string (with replaced values) is:
<add key="StorageConnectionString" value ="TableEndpoint=https://myaccount.table.core.windows.net/Table?sv=2015-04-05&tn=Table&sig=Signature&se=2099-99-99T12%3A00%3A00Z&sp=r" />
Finally, my console app code:
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
I think you need to use the StorageCredentials
class. Here is a sample:
StorageCredentials accountSAS = new StorageCredentials(sasToken);
CloudStorageAccount accountWithSAS = new CloudStorageAccount(accountSAS, "account-name", endpointSuffix: null, useHttps: true);
CloudTableClient tableClientWithSAS = accountWithSAS.CreateCloudTableClient();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With