簡體   English   中英

使用帳戶密鑰訪問 Azure Data Lake Storage Gen2

[英]Access Azure Data Lake Storage Gen2 using the account key

我正在嘗試使用文檔中指定的方法檢索 Azure Data Lake Storage Gen2 中目錄的所有路徑: https://docs.databricks.com/external-data/azure-storage.html ,特別是我正在嘗試訪問僅使用 storgae 帳戶密鑰(不是通過 Azure 服務主體或 SAS 令牌)。

文檔說我們只需要設置這個 conf:

spark.conf.set(
    "fs.azure.account.key.<storage-account>.dfs.core.windows.net",
    dbutils.secrets.get(scope="<scope>", key="<storage-account-access-key>"))

但是 n.netheless 我收到 403 permssion 錯誤:

ExecutionError: An error occurred while calling z:com.databricks.backend.daemon.dbutils.FSUtils.ls.
: Operation failed: "This request is not authorized to perform this operation using this permission.", 403, GET, https://<storage-account>.dfs.core.windows.net/<my-container>?upn=false&resource=filesystem&maxResults=5000&timeout=90&recursive=false, AuthorizationPermissionMismatch, "This request is not authorized to perform this operation using this permission. RequestId:ef2753bb-501f-00bf-3c6c-26d7f4000000 Time:2023-01-12T09:56:54.1924327Z"
    at shaded.databricks.azurebfs.org.apache.hadoop.fs.azurebfs.services.AbfsRestOperation.execute(AbfsRestOperation.java:248)

如果我只使用存儲密鑰,為什么我仍然會收到錯誤消息? 我有點困惑,因為使用服務主體我必須在存儲上授予 client_id 但在這種情況下我必須授予什么? 我只是用鑰匙..

任何幫助表示贊賞謝謝

我試圖在我的環境中重現相同的內容並得到以下結果

Go 到存儲帳戶 -> IAM -> +添加存儲 Blob 貢獻者。

在此處輸入圖像描述

配置存儲帳戶有兩種方式。

帶鑰匙庫

spark.conf.set( "fs.azure.account.key.<storage_account>.dfs.core.windows.net", dbutils.secrets.get(scope="<scope_name>", key="<Access_key>"))

沒有密鑰庫

spark.conf.set("fs.azure.account.key.<storage_account>.dfs.core.windows.net","Access_key")

在此處輸入圖像描述

有關更多信息,請參閱此SO線程。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM