I am unable to copy blob(Errror : CopySourceNotVerfied) using the SAS url generated dynamically using this code which I found here How can I generate an Azure blob SAS URL in Python?
account_name = 'account'
account_key = 'key'
container_name = 'feed'
blob_name='standard_feed'
requiredSASToken = generate_blob_sas(account_name=account_name,
container_name=container_name,
blob_name=blob_name,
account_key=account_key,
permission=BlobSasPermissions(read=True),
expiry=datetime.utcnow() + timedelta(hours=24))
Instead am able to copy blob when used the SAS token generated from the azure portal, I hardcoded and tested.
The Difference observed between two tokens are like below
Code generated : se=2022-09-15T17%3A47%3A06Z&sp=r&sv=2021-08-06&sr=b&sig=xxx (sr is b)
Manually Generated : sp=r&st=2022-09-14T17:13:49Z&se=2022-09-17T01:13:49Z&spr=https&sv=2021-06-08&sr=c&sig=xxxx (sr is c)
How to generate SAS token for an azure storage container? i.e the SAS token must have all required fields especially signedResource(sr) must be container(c)?
I tried to reproduce the same in my environment and got below results:
I got similar output:
I added start time in generate SAS in code:
Output : It has all required fields for SAS:
I also tested my generated SAS token with url and got below result:
I seen this error in your comment please check you have given correct blob name and path. kindly check the below proper URL.