I've started getting 403 Error on blobContainer.createIfNotExists. Following is the source code.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
string blobContainerName =string.IsNullOrEmpty(_sessionContext.DomainName) ? "localdevblob": _sessionContext.DomainName.ToLower();
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference(blobContainerName);
container.CreateIfNotExists();
Things verified:
- container name is lower case & confirms to the standard
- the local blob storage is accessible in the Storage Explorer and works fine in reading / uploading content
- connection string is: add key="StorageConnectionString" value="UseDevelopmentStorage=true"
Anticipating that upgrading the library might fix the issue:
- Upgraded the Storage Emulator to 5.2
- Upgraded the Nuget package WindowsAzure.Storage to 8.4.0 (it was 8.1.0 earlier but that was already giving error)
The exception screenshot is below:
UPDATE
Apparently, i just downloaded the sample from https://github.com/Azure-Samples/storage-blob-dotnet-getting-started.git and that works too. and when i compared the cloudBlobClient object in my project and the sample project i found that for some strange reason I found that blobClient (in my project) is missing "AuthenticationHandler" and the "Key" which would be causing the issue. But these 2 values are present in the sample project.