azure-sdk-for-python: ContainerClient exists method does not work with Container level SAS token.
- azure-storage-blob:
- 12.8.0:
- macOS:
- 3.8:
Describe the bug ContainerClient exists method does not work with Container level SAS token.
Error -
azure.core.exceptions.HttpResponseError: This request is not authorized to perform this operation.
RequestId:9c51628a-d01e-0000-3135-119766XXXXX
Time:2021-03-04T20:29:12.8555087Z
ErrorCode:AuthorizationFailure
Error:None
To Reproduce Steps to reproduce the behavior: Call the below code with SAS token generated at the container level.
container_client = ContainerClient(account_url='https://ABC.blob.core.windows.net/',
credential='<SAS>',
container_name='<CONTAINER_NAME>',
max_block_size=1000000,
max_single_put_size=1000000,
min_large_block_upload_threshold=1000000,
max_single_get_size=1000000,
max_chunk_get_size=1000000,
connection_timeout=2,
timeout=5)
print(container_client.exists())
Expected behavior True/False should be returned.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 18 (8 by maintainers)
@tasherif-msft : I am from @varun-shahdadpuri team. After going through ContainerClient class, i see that get_account_information() can be used with a container/blob level SAS. I tested and can confirm that it works successfully when container exists and returns “azure.core.exceptions.HttpResponseError: Operation returned an invalid status” error if container does not exist. can you review this analysis and provide feedback on this…
@varun-shahdadpuri unfortunately you would need to have an account level SAS to find out if a container exists or not.
Sorry once again for the inconvenience
Thanks @tasherif-msft - sounds like this is something that could be added to the docstring for the
ContainerClient.exists
method?