Azure CloudBlobContainer.CreateIfNotExists returns 403 forbidden
As we discussed in comments above, please make sure your keys valid when you start getting 403 status code back from the service. Keys can change if they have been re-generated through the portal or using service management API's
If you have recently upgraded your WindowsAzure.Storage instead of using the deprecated WindowsAzure.StorageClient dll then you could be experiencing this issue as the BlobRequestOptions and OperationContext have not been set
MSDN Link with CloudBlobContainer Create If Not Exists Method
http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.blob.cloudblobcontainer.createifnotexists.aspx
I had a similar issue when trying to connect to my local azure storage emulator. Through Azure Storage explorer the connection was successful but through a custom tool which uses REST API it was throwing 403 error. I had to manually include endpoints in the config and use http instead https.
More on that here (https://learn.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string)
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;
This may not be the solution to this particular problem, but it might help someone else.
I was getting a 403 error and had a hard time tracking down the solution. I finally figured out that my development machine's time was off by 2 hours. When I set the time correctly, the 403 went away.
Azure requires the UTC timestamp to be within 15 minutes of the request time.