Last active
July 27, 2020 20:18
-
-
Save shashankm28/3e2e99cc9e29fe96efcd6d76b72888e4 to your computer and use it in GitHub Desktop.
Connect to Azure Container using SAS URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient | |
def azure_connect_sas_url(source_container_sas_url, source_container_name): | |
try: | |
blob_source_service_client = BlobServiceClient(source_container_sas_url) | |
source_container_client = blob_source_service_client.get_container_client(source_container_name) | |
print ("SAS URL -- Connected.") | |
return source_container_client | |
except Exception as ex: | |
print ("Error: " + str(ex)) | |
def main(): | |
try: | |
azure_sas_url = input ('Please enter SAS URL: ') | |
container_name = input ('Please enter Container name: ') | |
## SAS URL | |
connection_instance = azure_connect_sas_url(azure_sas_url, container_name) | |
print ('Done') | |
except Exception as ex: | |
print ('main | Error: ', ex) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment