Azure 对 microsoft.aadiam/diagnosticSettings/write 的权限

标签 azure azure-active-directory azure-resource-manager

我尝试使用以下 URL 通过 REST 调用上述 API 提供程序: https://management.azure.com/providers/microsoft.aadiam/diagnosticSettingsapi-version=2017-04-01-preview

但是,即使我使用的服务主体是 AAD 租户中“全局管理员”角色的成员,我也会收到无权执行操作错误。

不过这个端点似乎没有记录。 有人知道使用服务主体调用此 API 端点需要什么吗?

谢谢, 大卫

最佳答案

尝试在 AD 应用中使用 microsoft.aadiam/diagnosticsettings/write 操作添加自定义角色。

根据doc ,您可以使用自定义角色进行操作。

This article lists the operations available for each Azure Resource Manager resource provider. These operations can be used in custom roles to provide granular role-based access control (RBAC) to resources in Azure.

有关创建自定义角色的更多详细信息,请参阅此 link .

示例:

{
  "Name":  "Test Operator",
  "Id":  "88888888-8888-8888-8888-888888888888",
  "IsCustom":  true,
  "Description":  "xxxxxx",
  "Actions":  [
                  microsoft.aadiam/diagnosticsettings/write,
                  microsoft.aadiam/diagnosticsettings/read
  ],
  "NotActions":  [

                 ],
  "DataActions":  [

                  ],
  "NotDataActions":  [

                     ],
  "AssignableScopes":  [
                           "/subscriptions/{subscriptionId1}",
                           "/subscriptions/{subscriptionId2}",
                           "/subscriptions/{subscriptionId3}"
                       ]
}

更新:

您可以使用具有全局管理员角色的用户帐户,请参阅以下步骤。

1.导航到Azure Active Directory -> 诊断设置 -> 添加诊断设置 -> 设置属性并打开开发者工具(F12) ->保存

2.在我们捕获的请求中,复制Bearer token

enter image description here

3.然后我们就可以在postman中测试api了。

请求网址:

Put https://management.azure.com/providers/microsoft.aadiam/diagnosticSettings/{name}?api-version=2017-04-01-preview

请求 header :

enter image description here

请求正文:

{
  "properties": {
    "logs": [
      {
        "category": "AuditLogs",
        "enabled": true,
        "retentionPolicy": {
          "days": 0,
          "enabled": false
        }
      },
      {
        "category": "SignInLogs",
        "enabled": true,
        "retentionPolicy": {
          "days": 0,
          "enabled": false
        }
      }
    ],
    "metrics": [],
    "storageAccountId": "/subscriptions/xxxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx"
  }
}

它对我有用。

enter image description here

关于Azure 对 microsoft.aadiam/diagnosticSettings/write 的权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53666223/

相关文章:

将数据库链接到 MVC 项目和移动应用程序 Xamarin 的 API

mysql - 无法远程连接到azure mysql数据库

azure - 新-AzureRmResourceGroupDeployment : A parameter cannot be found that matches parameter name '_artifactsLocationSasToken'

azure - EventHub 的 Azure 部署期间出现 429 错误

azure - 如何测试链接的ARM模板?

node.js - Multi-Tenancy Web应用程序: no verified domain

azure - 针对 ManagedAppPolicies 端点而非其他端点(即组)的 Intune API 请求收到 403

azure - 作为个人开发人员的 Microsoft Multi-Tenancy 应用程序 - Azure Active Directory

python - 如何根据服务主体 ID 限制对 azure 函数的访问

powershell - Azure Batch 容器配置中的 Azure 容器注册表的 AD 服务主体?