【问题标题】:Connecting to ADLS Gen 2 using Service Principals使用服务主体连接到 ADLS Gen 2
【发布时间】:2020-06-09 10:09:25
【问题描述】:

任何人都可以显示任何我可以使用服务主体连接到 ADLS Gen 2 的 python 代码

【问题讨论】:

    标签: python azure-data-lake service-principal


    【解决方案1】:

    首先,安装以下库:

    azure-storage-file-datalake

    azure-identity

    然后使用下面的代码:

    from azure.storage.filedatalake import DataLakeServiceClient
    from azure.identity import ClientSecretCredential
    
    tenant_id="xxx"
    client_id="xxx"
    client_secret="xxx"
    
    credential = ClientSecretCredential(tenant_id,client_id,client_secret)
    service = DataLakeServiceClient(account_url="https://xxx.dfs.core.windows.net/",credential=credential)
    
    #create a file system in ADLS Gen2
    file_system_client = service.create_file_system(file_system="myfileSystem")
    

    更多代码示例是here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-01
      • 1970-01-01
      • 2020-10-15
      • 2021-01-22
      • 2020-02-18
      • 1970-01-01
      • 2020-07-25
      • 1970-01-01
      相关资源
      最近更新 更多