Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A Python program to connect to Azure ADLS Gen2 (Storage Account) using azure service principle instead of the connection string.
from azure.identity import ClientSecretCredential
from import BlobServiceClient
# Tenant ID for your Azure Subscription
# Your Service Principal App ID (Client ID)
CLIENT_ID = "a3XXX40d-xxxxxxx-0ff72XXXX66a"
# Your Service Principal Password (Client Secret)
credentials = ClientSecretCredential(TENANT_ID, CLIENT_ID, CLIENT_SECRET)
blobService = BlobServiceClient(
print("\n==============LIST OF ALL BLOBS=================")
# Path in the container. If you want to list everything in the root path, keep it empty
prefix = ""
container = blobService.get_container_client(CONTAINER_NAME)
for blob in container.list_blobs(name_starts_with=prefix):
print("\t Blob name: " +
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment