問題描述
管理員有時(shí)需要根據(jù)組織的需求限制Azure AD用戶訪問特定資源的權(quán)限,本文描述的是如何而設(shè)置RBAC role以允許用戶讀取Azure Monitor中除活動(dòng)日志以外的所有信息。
解決方法
用戶可以參考如下JSON模板修改自定義角色屬性,其中"Actions":["Microsoft.Insights/*/read"]允許用戶讀取所有Azure Monitor中的數(shù)據(jù),"NotActions":["Microsoft.Insights/eventtypes/*"]在Actions中排除了對活動(dòng)日志的所有訪問權(quán)限。
JSON
{
"Name":"Custom Role",
"Id":null,
"IsCustom":true,
"Description":"No access to Monitor/Activity Log",
"Actions":[
"Microsoft.Insights/*/read"
],
"NotActions":[
"Microsoft.Insights/eventtypes/*"
],
"AssignableScopes":[
"/subscriptions/<xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx>"
]
}
使用JSON模板更新自定義用戶角色后,被授予該角色的用戶訪問資源的活動(dòng)日志時(shí),會(huì)查看到如下顯示“No permissions to run the selected query”。
由于該用戶對活動(dòng)日志的訪問權(quán)限限制,因此沒有權(quán)限運(yùn)行針對該資源活動(dòng)日志的篩選查詢,而得到如下返回結(jié)果: