Hello Pradeep:
Thanks for y our reply.
Jupyter Notebook is local on my laptop. I am Group admin on Azure and I have required permission under ADLS Gen2 Container.
Below you will see that I tried 3 different ways\option to access ADLS Gen2 from my laptop jupyter notebook and encounter similar & different errors.
Again, any help with proper document link is greatly appreciated.
Option - 1
AccountName='xxxxxxxxxx'
AccountKey='/xxxxxxxxxx'
tenant_id = 'xxxxxxxxxx'
client_secret = 'xxxxxxxxxx'
client_id = 'xxxxxxxxxx'
input_blobpath = 'https://xxxxxxxxxx'
from azure.common.credentials import ServicePrincipalCredentials
token = lib.auth(tenant_id = tenant_id, client_secret = client_secret, client_id = client_id,require_2fa=False, \
resource='https://xxxxxxxxxx')
Get Token request returned http error: 400 and server response: {"error":"invalid_resource","error_description":"AADSTS500011: The resource principal named https://storageAccountName was not found in the tenant named xxxxxxxxxx. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.\r\nTrace ID: 1ac78efb-95a9-4317-b18d-1b3272036800\r\nCorrelation ID: xxxxxxxxxx\r\nTimestamp: 2021-02-15 17:18:57Z","error_codes":[500011],"timestamp":"2021-02-15 17:18:57Z","trace_id":"1ac78efb-95a9-4317-b18d-1b3272036800","correlation_id":"xxxxxxxxxx","error_uri":"https://login.microsoftonline.com/error?code=500011"}
Option - 2
adlsFileSystemClient = core.AzureDLFileSystem(token, store_name=xxxxxxxxxxxx)
Read a file into pandas dataframe
with adlsFileSystemClient.open('xxxxxxxxxxxxxxxxxxxx', 'rb') as f:
df = pd.read_csv(f)
Show the dataframe
df
DatalakeRESTException: HTTP error: ConnectionError(MaxRetryError("HTTPSConnectionPool(host='kxxxxx.azuredatalakestore.net', port=443): Max retries exceeded with url: /webhdfs/v1/xxxxxxxxxxxxxx.csv?OP=GETFILESTATUS&api-version=2018-09-01 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f68387dafa0>: Failed to establish a new connection: [Errno -2] Name or service not known'))"))
Option - 3
tenant_id = 'xxxxxxxxxxxxxx'
client_secret = 'xxxxxxxxxxxxxx'
client_id = 'xxxxxxxxxxxxxx'
container_name = 'xxxxxxxxxxxxxx'
blob_name = 'xxxxxxxxxxxxxx.csv'
credentials = ServicePrincipalCredentials(client_id=client_id, secret=client_secret, tenant=tenant_id)
service = BlobServiceClient(account_url="https://xxxxxxxxx/", credential=credentials)
block_blob_service = BlobServiceClient(account_url='https://xxxxxxxxx',account_name=account_name, account_key=account_key)
csv_content = service.get_blob_to_text(container_name, blob_name).content
print(csv_content)
TypeError: Unsupported credential: <msrestazure.azure_active_directory.ServicePrincipalCredentials object at 0x7f683853f610>