Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403 Forbidden from import #273

Closed
cqw1 opened this issue Feb 26, 2017 · 2 comments
Closed

403 Forbidden from import #273

cqw1 opened this issue Feb 26, 2017 · 2 comments

Comments

@cqw1
Copy link

cqw1 commented Feb 26, 2017

I have a django web app deployed as an Azure App Service. I have also been using the azure-storage SDK for python to upload and download images from Azure Blob Storage. When I run it locally, the app runs fine and I can successfully push and pull images. However, when I deploy the app, I get this error:

2017-02-26T22:15:16
Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (403) Forbidden. ---> System.Net.WebException: The remote server returned an error: (403) Forbidden.
at System.Net.HttpWebRequest.GetResponse()
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand1 cmd, IRetryPolicy policy, OperationContext operationContext) --- End of inner exception stack trace --- at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand1 cmd, IRetryPolicy policy, OperationContext operationContext)
at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.DownloadBlockList(BlockListingFilter blockListingFilter, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
at Microsoft.WindowsAzure.WebSites.Diagnostics.AzureBlobTraceListener.AppendStreamToBlob(Stream stream)
at Microsoft.WindowsAzure.WebSites.Diagnostics.AzureBlobTraceListener.ConsumeBuffer()
Request Information
RequestID:25101a94-0001-00f5-3a7d-90b249000000
RequestDate:Sun, 26 Feb 2017 22:15:16 GMT
StatusMessage:Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
ErrorCode:AuthenticationFailed

I've pinpointed it to import statements. If I just include from azure.storage.blob import BlockBlobService, I get this error. I don't create a BlockBlobService or call anything else yet.

I have tried adding an account SAS from my Azure Storage account and setting it as a DIAGNOSTICS_AZUREBLOBCONTAINERSASURL setting, but that doesn't work either.

I'm not sure what's causing this error?

@rambho
Copy link

rambho commented Feb 28, 2017

Hi @cqw1 ,
What version of the Python Storage SDK are you using?

I've pinpointed it to import statements. If I just include from azure.storage.blob import BlockBlobService, I get this error. I don't create a BlockBlobService or call anything else yet.

Can you check if this occurs when importing any of the other Blob types?

Few thoughts -- there is a known issue with deployment on Azure WebApps introduced in version 0.33.0 and onwards due to the cryptography dependency and outdated pip on WebApps. See #219.
For quick confirmation, use version 0.32.0 of the library in your requirements.txt and deploy/see if this problem still persists. You'll want to log into your WebApps kudu console to make sure that version 0.32.0 is in fact installed and being used. If that is the case, see the issue reference above for resolution.
I have the latest version deployed and working fine right now, but I did have a similar issue which I was able to fix with the above steps. Let me know if that helps.

@cqw1
Copy link
Author

cqw1 commented Feb 28, 2017

I was using 0.34.0, but after setting azure-storage==0.32.0 in my requirements.txt it works now!

Thanks for all the help!

@cqw1 cqw1 closed this as completed Feb 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants