Hello Chilakapati Jyothirmayi,
Greetings! Welcome to Microsoft Q&A Platform.
Yes, In Power BI you can create a service Shared Access Signature (SAS) for Azure Blob Storage using Python. A shared access signature (SAS) enables you to grant limited access to containers and blobs in your storage account. When you create a SAS, you specify its constraints, including which Azure Storage resources a client is allowed to access, what permissions they have on those resources, and how long the SAS is valid.
You can create a service SAS to delegate limited access to a blob resource using the following method:
The storage account access key used to sign the SAS is passed to the method as the account_key
argument. Allowed permissions are passed to the method as the permission
argument, and are defined in the BlobSasPermissions class.
The following code example shows how to create a service SAS with read permissions for a blob resource:
def create_service_sas_blob(self, blob_client: BlobClient, account_key: str):
# Create a SAS token that's valid for one day, as an example
start_time = datetime.datetime.now(datetime.timezone.utc)
expiry_time = start_time + datetime.timedelta(days=1)
sas_token = generate_blob_sas(
account_name=blob_client.account_name,
container_name=blob_client.container_name,
blob_name=blob_client.blob_name,
account_key=account_key,
permission=BlobSasPermissions(read=True),
expiry=expiry_time,
start=start_time
)
return sas_token
You can find more information on how to create a SAS service for a Blob using Python in the following links - https://video2.skills-academy.com/en-us/azure/storage/blobs/sas-service-create-python, https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/storage/blobs/sas-service-create-python.md
Hope this answer helps! Please let us know if you have any further queries. I’m happy to assist you further.
Please "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.