尝试读取 Azure Synapse 中链接存储上的镶木地板文件

Attempting to Read parcquet files on linked storage in Azure Synapse

我正在尝试授予对 Gen2 Data Lake 容器上 parquet 文件的访问权限。我在容器上有所有者 RBAC,但更愿意限制其他用户在容器中的访问。

我的查询很简单:

SELECT
  TOP 100 *
FROM
  OPENROWSET(
    BULK 'https://aztsworddataaipocacldl.dfs.core.windows.net/pocacl/Top/Sub/part-00006-c62926ba-c530-4ad8-87d1-cf38c67a2da3-c000.snappy.parquet',
    FORMAT='PARQUET'
  ) AS [result]

当我 运行 连接时没有问题。我试图将 ACL 权限添加到文件(当然还有包含文件夹 'Top' 和 'Sub')。

I've give RWX on the 'Top' folder using Storage Explorer and default so that it cascades to the 'Sub' folder and parquet files as I add them

当我的同事尝试 运行 SQL 脚本时,收到错误消息。 Failed to execute query. Error: File 'https://aztsworddataaipocacldl.dfs.core.windows.net/pocacl/Top/Sub/part-00006-c62926ba-c530-4ad8-87d1-cf38c67a2da3-c000.snappy.parquet' cannot be opened because it does not exist or it is used by another process. NB 在 Spark 中也有类似的结果,但使用的是 403

SQL on-demand 提供一个link到following help file后报错,提示:

If your query fails with the error saying 'File cannot be opened because it does not exist or it is used by another process' and you're sure both file exist and it's not used by another process it means SQL on-demand can't access the file. This problem usually happens because your Azure Active Directory identity doesn't have rights to access the file. By default, SQL on-demand is trying to access the file using your Azure Active Directory identity. To resolve this issue, you need to have proper rights to access the file. Easiest way is to grant yourself 'Storage Blob Data Contributor' role on the storage account you're trying to query.

我不希望授予 Storage Blob Data Contributor 或 Storage Blob Data Reader,因为这允许访问容器上的每个文件,而不仅仅是那些我希望最终用户能够查询的文件。我们发现 SSMS 连接到 parquet 外部表时也会出现相同的体验。

那么分几部分:

  1. 这是使用 ACL 授予访问权限的正确模式吗,还是我应该使用其他方法?
  2. 存储帐户上或我的 query/notebook 中是否有我应该启用以支持 ACL 的设置?*
  3. 鉴于我们仍处于预览阶段,ACL 是否已在 Synapse Workspace 上实施?

*我拒绝粘贴我的整个设置,因为我真的不知道什么是相关的,什么是与这个问题完全不相关的,但当然可以提供。

当您将 ACL 分配给文件夹时,它不会递归传播到文件夹内的所有文件。只有新文件会继承该文件夹。

你可以看到这个here

ACL 功能在 Azure Synapse Analytics 预览版中似乎无法正常工作。

我现在已经设法让它工作了。目前我看到,一旦将 Read|Execute 提供给文件夹,它就允许访问该文件夹和子文件夹中包含的文件。即使没有为子文件夹中的文件提供特定的 ACL 访问权限,也可以访问。这不是我所期望的,但它足以让我继续:只允许访问 Gold 文件夹允许分离对我想让用户查询的文件和我想隐藏的工作文件的访问。