# Documentation: https://docs.microsoft.com/en-us/python/api/overview/azure/storage-file-share-readme?view=azure-python#creating-the-client-from-a-connection-string
# Install required libraries in the notebook container - Alternatively do this using Custom Images
!pip install azure-storage-file-share
# Connection information to my personal Azure file storage
storage_account_name = "zepltest"
share_name = "zepl_share"
file_name = "diabetes.csv"
# Generate SAS and Connection String - # Valid until - 2020-10-26 07:30:01Z
# Using Zepl's Secret Store
connection_string = "BlobEndpoint=https://zeplstorage.blob.core.windows.net/;QueueEndpoint=https://zeplstorage.queue.core.windows.net/;FileEndpoint=https://zeplstorage.file.core.windows.net/;TableEndpoint=https://zeplstorage.table.core.windows.net/;SharedAccessSignature={}".format(z.getDatasource("Azure_Storage_Account")["signature"])
from azure.storage.fileshare import ShareDirectoryClient
# Connect to Azure File Directory service
parent_dir = ShareDirectoryClient.from_connection_string(conn_str=connection_string, share_name=share_name, directory_path=parent_dir)
# Get and Print folder structure
my_list = list(parent_dir.list_directories_and_files())