azure - 错误:检测到 fs.azure.account.key 的配置值无效
问题描述
我正在使用 Azure Databricks 使用 ADLS Gen2 在 Azure Blob 存储中创建一个增量表,但我在最后一行收到错误“无法初始化 configurationInvalid configuration value detected for fs.azure.account.key”
%scala
spark.conf.set(
"fs.azure.account.oauth2.client.secret",
"<storage-account-access-key>")
friends = spark.read.csv('myfile/fakefriends-header.csv',
inferSchema = True, header = True)
friends.write.format("delta").mode('overwrite')\
.save("abfss://tempfile@tempaccount.dfs.core.windows.net/myfile/friends_new")
请帮助我如何避免此错误
解决方案
简短的回答 - 您不能使用存储帐户访问密钥来使用abfss
协议访问数据。如果你想使用,你需要提供更多的配置选项abfss
——这一切都在文档中描述。
spark.conf.set(
"fs.azure.account.auth.type.<storage-account-name>.dfs.core.windows.net",
"OAuth")
spark.conf.set(
"fs.azure.account.oauth.provider.type.<storage-account-name>.dfs.core.windows.net",
"org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider")
spark.conf.set(
"fs.azure.account.oauth2.client.id.<storage-account-name>.dfs.core.windows.net",
"<application-id>")
spark.conf.set(
"fs.azure.account.oauth2.client.secret.<storage-account-name>.dfs.core.windows.net",
dbutils.secrets.get(scope="<scope-name>",key="<service-credential-key-name>"))
spark.conf.set(
"fs.azure.account.oauth2.client.endpoint.<storage-account-name>.dfs.core.windows.net",
"https://login.microsoftonline.com/<directory-id>/oauth2/token")
存储访问密钥只能在使用时使用wasbs
,但不建议与 ADLSGen2 一起使用。
PS如果您有权访问该存储帐户,您也可以使用直通集群。
推荐阅读
- javascript - 将 img 标签添加到文本区域以输入到文本文件中
- node.js - 我收到一个错误“UnhandledPromiseRejectionWarning: NoSuchSessionError: no such session”
- c++ - 为什么在没有命名空间 `std` 的情况下`endl` 工作正常?
- ruby - 如何在 ruby 中使用来自 yaml 的登录凭据
- javascript - Angularjs - Getter 和 Setter 以及数据绑定多个控制器
- database - 就架构更改而言,何时选择 eav 反对平面表?
- javascript - 使用 jQuery 在多个元素上激活悬停状态
- php - 带图像的 Sylius 自定义模型
- angular - 如何使用 ControlValueAccessor?
- android - 如何让我的应用在所有设备上运行?