操作失败:“此请求无权执行此操作。”与Pyspark笔记本的突触

发布于 2025-02-10 02:13:31 字数 1501 浏览 1 评论 0 原文

我尝试执行以下命令行:

mssparkutils.fs.ls("abfss://[email protected]/myfolder/")

我得到错误:

Py4JJavaError: An error occurred while calling z:mssparkutils.fs.ls.
: java.nio.file.AccessDeniedException: Operation failed: "This request is not authorized to perform this operation.", 403, GET, https://myadfs.dfs.core.windows.net/mycontainer?upn=false&resource=filesystem&maxResults=5000&directory=myfolder&timeout=90&recursive=false, AuthorizationFailure, "This request is not authorized to perform this operation.

我遵循此 link

通过授予对我和我的访问权限我的Synapse工作区“存储斑点数据贡献者”在容器或文件系统级别中的作用:

“在此处输入图像说明”

”在此处inter 即便如此,我仍然会遇到这个持久错误。我是否错过其他步骤?

I try to execute the following command line:

mssparkutils.fs.ls("abfss://[email protected]/myfolder/")

I get the error:

Py4JJavaError: An error occurred while calling z:mssparkutils.fs.ls.
: java.nio.file.AccessDeniedException: Operation failed: "This request is not authorized to perform this operation.", 403, GET, https://myadfs.dfs.core.windows.net/mycontainer?upn=false&resource=filesystem&maxResults=5000&directory=myfolder&timeout=90&recursive=false, AuthorizationFailure, "This request is not authorized to perform this operation.

I followed the steps described in this link

by granting access to me and my Synapse workspace the role of "Storage Blob Data Contributor" in the container or file system level:

enter image description here

enter image description here
Even that, I still get this persistent error. Am I missing other steps?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一桥轻雨一伞开 2025-02-17 02:13:31

我在环境中也有同样的错误。我刚刚跟随此 官方文件 并完成了repro,现在对我来说很好。您可以按照以下代码解决您的问题。

示例代码:

from pyspark.sql import SparkSession
account_name = 'your_blob_name'
container_name = 'your_container_name'
relative_path = 'your_folder path'
linked_service_name = 'Your_linked_service_name'

sas_token = mssparkutils.credentials.getConnectionStringOrCreds(linked_service_name)

“

访问blob存储

path = 'wasbs://%s@%s.blob.core.windows.net/%s' % (container_name,account_name,relative_path)   
spark.conf.set('fs.azure.sas.%s.%s.blob.core.windows.net' % (container_name,account_name),sas_token)
  
print('Remote blob path: ' + path)

“

样本输出:

i.sstatic.net/njobg.png“ rel =“ nofollow noreferrer 答案

引用pyspark笔记本中的配置火花:

https://techcommunity.microsoft.com/t5/azure-synapse-analytics-blog/notebook-this-请求 - 毫无授权到绩效 - 此/ba-p/1712566

I got the same kind of error in my environment. I just followed this official document and done the repro, now it's working fine for me. You can follow the below code it will solve your problem.

Sample code:

from pyspark.sql import SparkSession
account_name = 'your_blob_name'
container_name = 'your_container_name'
relative_path = 'your_folder path'
linked_service_name = 'Your_linked_service_name'

sas_token = mssparkutils.credentials.getConnectionStringOrCreds(linked_service_name)

Ref1

Access to Blob Storage

path = 'wasbs://%s@%s.blob.core.windows.net/%s' % (container_name,account_name,relative_path)   
spark.conf.set('fs.azure.sas.%s.%s.blob.core.windows.net' % (container_name,account_name),sas_token)
  
print('Remote blob path: ' + path)

Ref2

Sample output:

Ref3

Updated answer

Reference to configure Spark in pyspark notebook:

https://techcommunity.microsoft.com/t5/azure-synapse-analytics-blog/notebook-this-request-is-not-authorized-to-perform-this/ba-p/1712566

遗失的美好 2025-02-17 02:13:31

另一种可能性是,您的存储防火墙在包含数据湖/斑点容器的存储帐户上运行。

据我所知,除非您在Synapse实例上启用了私有网络,否则就无法解决此问题 - 在这种情况下,您可以创建一个托管的私有端点,以使SPARK成为存储网络路由。

Another possibility is that you have Storage Firewall running on the Storage Account containing your Data Lake/Blob Container.

As far as I can make out there is not way around this unless you have private networking enabled on your Synapse instance - in which case you can create a Managed Private Endpoint to enable a Spark to Storage network route.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文