BlobClient returns ClientAuthenticationError when Azure CDN is enabled
See original GitHub issue- Package Name: azure-storage-blob
- Package Version: 12.10.0
- Operating System: Ubuntu 20.04.4 LTS
- Python Version: 3.9.5
Describe the bug
Calling the BlobClient.exists
method raises a ClientAuthenticationError
when an Azure CDN account URL is used.
To Reproduce Steps to reproduce the behavior:
from azure.storage.blob import BlobServiceClient
ACCOUNT_NAME = "myaccount"
ACCOUNT_KEY = "myaccount-key"
CREDENTIAL = {"account_name": ACCOUNT_NAME, "account_key": ACCOUNT_KEY}
ACCOUNT_URL = f"https://{ACCOUNT_NAME}.blob.core.windows.net"
ACCOUNT_URL_CDN = f"https://{ACCOUNT_NAME}.azureedge.net"
ACCOUNT_URL_CDN_CUSTOM = f"https://static.{ACCOUNT_NAME}.com"
CONTAINER_NAME = "mycontainer"
BLOB_NAME = "path/to/image.png"
# The "standard" blob client endpoint
blob_client = BlobServiceClient(
account_url=ACCOUNT_URL,
credential=CREDENTIAL,
).get_blob_client(
container=CONTAINER_NAME,
blob=BLOB_NAME,
)
# This works! It returns True
blob_client.exists()
# Now, using the Azure CDN blob endpoint
blob_client_cdn = BlobServiceClient(
account_url=ACCOUNT_URL_CDN,
credential=CREDENTIAL,
).get_blob_client(
container=CONTAINER_NAME,
blob=BLOB_NAME,
)
# This does not work, it raises a `ClientAuthenticationError` error
blob_client_cdn.exists()
# Using a custom CDN (which is fully verified)
blob_client_cdn_custom = BlobServiceClient(
account_url=ACCOUNT_URL_CDN_CUSTOM,
credential=CREDENTIAL,
).get_blob_client(
container=CONTAINER_NAME,
blob=BLOB_NAME,
)
# This does not work, it raises a `ClientAuthenticationError` error
blob_client_cdn_custom.exists()
Expected behavior I would expect the client to authenticate correctly when using an Azure CDN or a custom CDN when the client authenticates correctly when using the standard blob endpoint.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:23 (8 by maintainers)
Top Results From Across the Web
Azure Blob Storage fails to authenticate: "Make sure the value ...
Hi I am trying to upload a binary file (a blob for an excel file, actually) to my storage account but the client...
Read more >AzureStorage Blob Server failed to authenticate the request ...
I got an error while uploading files into Azure Blob storage with metadata, the error is "Server failed to authenticate the request. Make...
Read more >azure-storage-blob - PyPI
BlobLeaseClient - this client represents lease interactions with a ContainerClient or BlobClient . It provides operations to acquire, renew, release, change, ...
Read more >Azure.Storage.Blobs 12.14.1 - NuGet
A blob in a container used via BlobClient. Learn more about options for authentication (including Connection Strings, Shared Key, Shared Key Signatures, Active...
Read more >Enabling Azure CDN for the storage account
This blog post shows how to enable Azure Content Delivery Network (CDN) by creating a new CDN profile and CDN endpoint. Prerequisites.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@vincenttran-msft I have generated a few more
RequestID
s for you (just in case you didn’t manage to get to see the others - I guess were a few timezone apart).These were generated using the example code in my original Steps to reproduce the behaviour (with account names and credentials updated).
This issue is preventing us from going live with our project. I would be willing to send you access tokens and keys (which I can recycle, if we do eventually get to go live) so you can reproduce the error yourself.
I have pasted the full output from running my Steps to reproduce the behaviour script if it helps.
I deleted the existing
Microsoft CDN (classic)
CDN, and created a new one with theStandard Verizon
pricing tier. This has resolved the issue.I will mark this issue as closed. Thank you for your time and patience @vincenttran-msft