【问题标题】:Add user rights to Data Lake Store Gen2 Folder with Azure CLI使用 Azure CLI 将用户权限添加到 Data Lake Store Gen2 文件夹
【发布时间】:2020-04-30 16:28:56
【问题描述】:

我们想在我们的部署管道中使用 Azure CLI 为 DataLake Gen2 中的企业应用程序设置特定权限。我们使用 powersehell 7.0 和 az storage 扩展。

我可以通过 cli 为用户、组和其他设置权限,但不能为特定用户设置权限。此用户必须具有贡献者角色 (rw-)

我已尝试设置权限:

az extension add --name storage-preview
az storage blob directory access set -a "default:$user::rw-" -d $dirname -c $filesystemName --account-name $storageaccountname

但是却报错:'error":{"code":"InvaldAccessControlList","message":"访问控制列表值无效'

运行时

az storage blob directory access show -d $dirname  -c $filesystemName  --account-name $storageaccountname
{
  "acl": "user::rwx,group::r-x,other::---,default:user::rw-,default:group::r-x,default:other::---",
  "group": "dummy000-0000-0000-00000000000",
  "owner": "$superuser",
  "permissions": "rwxr-x---+"
}

看来我无法通过这种方式设置特定权限。我无法使用门户。是否有我可以使用的 CLI 命令。 documentation对此不是很清楚。

【问题讨论】:

    标签: azure azure-blob-storage acl azure-data-lake


    【解决方案1】:

    我阅读了关于 ACL 的 linux 文档并将命令更改如下:

    #Get Object ID from the aplicationID:
    $user = az ad sp show --id dummy000-0000-0000-00000000000 --query objectId 
    
    # set default rights to the application and strip the quotes from the objectid
    $set = "default:user:"+$user.Replace("`"","")+":rw-"
    
    #set the default rights (child items and new as well):
    az storage blob directory access set -a $set -d $dirname -c $filesystemName --account-name $storageaccountname
    
    #check rights:
    az storage blob directory access show -d $dirname  -c $filesystemName  --account-name $storageaccountname
    

    您也可以将广告电子邮件地址用作用户。

    【讨论】:

      猜你喜欢
      • 2019-11-26
      • 1970-01-01
      • 1970-01-01
      • 2020-02-22
      • 1970-01-01
      • 2023-04-02
      • 2019-07-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多