azure - 从图表编辑现有条件访问策略

标签 azure graph azure-active-directory conditional-statements policy

我使用之前问题回复 here 中的内容创建了条件访问策略。它正在按预期工作。

POST https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies
Content-type: application/json
{

"displayName": "Block access to Application Admins.",
"state": "enabled",
"conditions": {
    "clientAppTypes": [
        "all"
    ],
    "applications": {
        "includeApplications": [
            "appID"
        ]
    },
    "users": {
        "includeRoles": [
            "9b895d92-2cd3-44c7-9d02-a6ac2d5ea5c3"//ID of Application Admin role
        ]
    }
},
"grantControls": {
    "operator": "OR",
    "builtInControls": [
        "block"
    ]
}
}

我想更改一些属性,例如将角色更改为用户管理员和 grantControls,以允许在 Graph 的现有策略中使用 MFA 进行访问。

在 Portal 中,我们有编辑选项,但这可以从 Graph 中实现吗?如何实现这一目标?

TIA

最佳答案

我尝试通过 Graph Explorer 在我的环境中重现相同的内容并得到以下结果:

我有一个现有条件访问策略,具有以下属性:

enter image description here

要通过 Graph API 更新此政策,请根据您的要求使用以下查询:

PATCH https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies/<id>
Content-type: application/json

{
"displayName": "Require MFA to User Administrators.",
"state": "enabled",
"conditions": {
    "users": {
        "includeRoles": [
            "fe930be7-5e62-47db-91af-98c3a49a38b1"  //ID of User Administrator role
        ]
    }
},
"grantControls": {
    "operator": "OR",
    "builtInControls": [
        "mfa"
    ]
}
}

回应:

enter image description here

当我在门户中检查相同内容时,属性已更新成功,如下所示:

enter image description here

您可以获取用户管理员角色的id,如下所示:

转到 Azure 门户 -> Azure AD -> 角色和管理员 -> 所有角色 -> 用户管理员

enter image description here

更新:

您可以使用以下查询获取策略的id:

GET https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies?$filter=displayName eq 'policyName' &$select=id,displayName

回应:

enter image description here

关于azure - 从图表编辑现有条件访问策略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74191369/

相关文章:

graph - 二部图和等长环

java - 航类时刻表算法

excel - Azure 在 Azure 函数中读取 Excel Online 文档

azure - graph.windows.net 抛出 503 服务器不可用错误

Azure 预览门户不允许我从 bacpac 导入数据库

python - Anaconda 中的线图

使用 SAML 的 Azure AD 用户角色声明

microsoft-graph-api - Office api V2 身份验证范围内的多个资源

azure - 如何使用一个链接为具有管理员同意和未经管理员同意的租户用户进行授权?

azure - 错误请求 - 在 Azure 本地存储中创建表