Skip to content

Instantly share code, notes, and snippets.

@geralexgr
Last active February 21, 2023 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geralexgr/e7ac79356b9fb103c61b884257ccc908 to your computer and use it in GitHub Desktop.
Save geralexgr/e7ac79356b9fb103c61b884257ccc908 to your computer and use it in GitHub Desktop.
import os, uuid
from azure.identity import DefaultAzureCredential
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient
connection_string = "CONNECTION_STRING"
service = BlobServiceClient.from_connection_string(connection_string)
try:
account_info = service.get_account_information()
print('Using Storage SKU: {}'.format(account_info['sku_name']))
container_client = service.get_container_client("files")
try:
for blob in container_client.list_blobs():
print("Found blob: ", blob.name)
except ResourceNotFoundError:
print("Container not found.")
except Exception as ex:
print('Exception:')
print(ex)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment