How to Create BlobServiceClient with linked service, SAS token or Service Principle

Shao Peng Sun 81 Reputation points

I can create BlobServiceClient with the python SDK below. The "connection_string" is the connection_string I got from web console of Storage Account which including Access Key
blob_service_client = BlobServiceClient.from_connection_string(connection_string)

But now I don't have the access key of that Storage Account. What I have is a linked service to this Storage Account. And probably have SAS token or Service principle. But anybody could help how could I use linked service, SAS token or Service Principle to create BlobServiceClient with python?

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,376 questions
Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,769 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,494 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. SaiKishor-MSFT 17,211 Reputation points

    @Shao Peng Sun Thanks for reaching out to Microsoft Q&A. I understand that you are looking for creating Blob Service Client with either Linked service, SAS token or service principle. Please correct me otherwise.

    Please refer to the below code snippets-

    Create blob service client using a shared access key-

    Create blob service client using ClientSecretCredential-

    Create blob service client using Azure Identity-

    This doc shows how to construct the BlobServiceClient Class using SAS -

    Does this help? Please let me know. Thank you!


    Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.

    Want a reminder to come back and check responses? Here is how to subscribe to a notification.

    0 comments No comments