I am trying to generator container shared access signature (SAS) using python. I am getting invalid base64 encoded error.
sas_token = generate_container_sas(
account_name=account_name,
container_name=settings.AZURE_CONTAINER_NAME,
account_key=account_key,
permission=BlobSasPermissions(read=True),
expiry=expiry_time,
start=start_time
)
Error message
Exception: Invalid base64-encoded string: number of data characters (85) cannot be 1 more than a multiple of 4
I tried to find reason on azure document but failed.
I tried in my environment and got the same error:
Error:
The above error occurs when you pass the wrong access key in the
generate_container_sascondition.You can get the access key from the portal:
When I use the below code with the correct access key. I can able to get the container SAS token with url.
Code:
Output:
Reference:
azure.storage.blob package | Microsoft Learn