【问题标题】:Getting error Invalid configuration value detected for fs.azure.account.key while reading file from ADLS Gen2 using service principal使用服务主体从 ADLS Gen2 读取文件时,检测到 fs.azure.account.key 的错误配置值无效
【发布时间】:2019-08-05 19:52:13
【问题描述】:

使用服务主体从 ADLS Gen2 读取文件时出现错误。

configs = {"fs.azure.account.auth.type": "OAuth",
           "fs.azure.account.oauth.provider.type": 
           "org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider",
           "fs.azure.account.oauth2.client.id": "<your-service-client-id>",
           "fs.azure.account.oauth2.client.secret": dbutils.secrets.get(scope 
           = "<scope-name>", key = "<key-name>"),
           "fs.azure.account.oauth2.client.endpoint": 
           "https://login.microsoftonline.com/<your-directory-id>/oauth2/token"}

以下代码用于读取文件:

df=spark.read.csv('abfss:
//tempfile@tempaccount.dfs.core.windows.net/temp.csv')

出现以下错误:

检测到 fs.azure.account.key 的配置值无效

【问题讨论】:

    标签: azure-data-lake azure-databricks


    【解决方案1】:

    您可以尝试以下方法:

    而不是这一行:

    "fs.azure.account.oauth2.client.secret": dbutils.secrets.get(scope = "&lt;scope-name&gt;", key = "&lt;key-name&gt;"),

    尝试如下使用:

    "fs.azure.account.oauth2.client.secret": "<key-name>",
    

    希望这会有所帮助。


    如果这回答了您的问题,请点击“标记为答案”和“投票”。而且,如果您有任何进一步的疑问,请告诉我们。

    【讨论】:

    • 如果你有钥匙,那么你可以使用@CHEEKATLAPRADEEP-MSFT 回答
    • 你好@CHEEKATLAPRADEEP-MSFT 我有同样的问题,但我不明白如何传递 值。你能把正确的方法吗?提前谢谢我的朋友
    【解决方案2】:

    定义配置后,您还需要设置它。

    [spark.conf.set(key, value) for (key, value) in configs.items()]
    

    【讨论】:

      猜你喜欢
      • 2021-04-07
      • 2020-12-03
      • 2019-12-27
      • 2020-06-09
      • 2020-04-20
      • 2023-04-06
      • 2013-07-05
      • 2013-03-05
      • 1970-01-01
      相关资源
      最近更新 更多