【问题标题】:How to enable Privileged Identity Management(PIM) for Storage blob data reader role in Azure如何在 Azure 中为存储 blob 数据读取器角色启用特权身份管理 (PIM)
【发布时间】:2022-08-03 23:38:16
【问题描述】:

我有一个 Azure 存储帐户,其中有多个容器。我需要使用安全组( /via 访问包)授予对特定容器的访问权限。

考虑到 Azure 中的最低权限访问,如何启用对我的数据存储/容器(例如 blob)的访问权限,以便用户可以在从 Azure 访问特定容器(例如 Blob)之前启动 PIM?

需要通过特权身份管理 (PIM) 的角色可能是:

 Storage  blob data reader
 Storage blob date contributor

我在这里学习 MS 教程(Link1link2Link3)。但是,无法为此找出正确和最佳的方法。还有其他分步指南吗?谢谢

    标签: azure azure-active-directory azure-rbac


    【解决方案1】:

    首先,您可以将use the Azure portal 本身用于存储 Blob 数据贡献者、存储 Blob 数据所有者,其中Azure role assignment condition 可以作为附加检查,您可以选择添加到您的角色分配中以提供更多fine-grained access control.

    Add or edit Azure role assignment conditions :PORTAL

    点击添加条件进一步细化基于存储属性的角色分配。

    然后,您可以添加资源和条件,例如:如果所选用户尝试读取没有 Project=Cascade 标记的 blob,则不允许访问。

    资源表示该属性在资源上,例如container name. 您必须键入名称并且不会列出下拉列表来选择 blob。

    这也可以从ARM template 完成。 以下模板显示了如何为存储 Blob 数据读取者角色分配条件。条件检查容器名称是否等于“blob-example-container”,可以用资源给出@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:name] StringEquals 'blobs-example-container'

    {
        "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
        "contentVersion": "1.0.0.0",
        "parameters": {
            "principalId": {
                "type": "string",
                "metadata": {
                    "description": "Principal ID to assign the role to"
                }
            },
            "principalType": {
                "type": "string",
                "metadata": {
                    "description": "Type of principal"
                }
            },
            "roleAssignmentGuid": {
                "type": "string",
                "defaultValue": "[newGuid()]",
                "metadata": {
                    "description": "New GUID used to identify the role assignment"
                }
            }
        },
        "variables": {
            "StorageBlobDataReader": "[concat(subscription().Id, '/providers/Microsoft.Authorization/roleDefinitions/2a2b9908-6ea1-4ae2-8e65-a410df84e7d1')]" // ID for Storage Blob Data Reader role, but can be any valid role ID
        },
        "resources": [
            {
                "name": "[parameters('roleAssignmentGuid')]",
                "type": "Microsoft.Authorization/roleAssignments",
                "apiVersion": "2020-04-01-preview", // API version to call the role assignment PUT.
                "properties": {
                    "roleDefinitionId": "[variables('StorageBlobDataReader')]",
                    "principalId": "[parameters('principalId')]",
                    "principalType": "[parameters('principalType')]",
                    "description": "Role assignment condition created with an ARM template",
                    "condition": "((!(ActionMatches{'Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read'})) OR (@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:name] StringEquals 'blobs-example-container'))", // Role assignment condition
                    "conditionVersion": "2.0"
                }
            }
        ]
    }
    

    但除了使用time-bound setting, approval workflow, audit trail, and so on 以及细粒度条件来保护和限制用户之外,您可能需要使用 PIM 并添加其他属性,例如 scheduleInfo、管理员访问权限 就像您使用门户或 ARM pim-resource-roles-assign-roles 链接到这里的那个一样

    {
      "properties": {
        "principalId": "a3bb8764-cb92-4276-9d2a-ca1e895e55ea",
        "roleDefinitionId": "/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608",
    
        "requestType": "AdminAssign",
        "scheduleInfo": {
          "startDateTime": "2022-07-05T21:00:00.91Z",
          "expiration": {
            "type": "AfterDuration",
            "endDateTime": null,
            "duration": "P365D"
          }
        },
        "condition": "@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'",
        "conditionVersion": "1.0"
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-13
      • 2015-09-02
      • 2020-04-02
      相关资源
      最近更新 更多