RBAC 最小权限审计
rbac-audit
当操作员或定时任务请求对 Zava Learning 资源组进行周期性 RBAC/最小权限审计时使用——枚举该组上实际生效的角色分配,将每个身份与实际的活动日志(Activity-Log)使用情况关联,以发现从未使用过的长期访问权限,标记权限过高、直接分配(而非通过组管理)的身份以及过期的故障排查访问权限,并推荐最小权限的修正措施。只读;生成用于报告的审计发现。
- License 许可
- MIT
- 最近更新
- 2026-11-10
- Stars
- ★ 189
- Forks
- 198
01 前言 Front Matter
- name
- rbac-audit
- tools
- [ "RunAzCliReadCommands", "GetAzCliHelp", "SearchMemory", "ExecutePythonCode", "microsoft-learn_microsoft_docs_search" ]
- metadata
- { "kind": "Skill", "api_version": "azuresre.ai/v2" }
- description
- Use when an operator or a scheduled task requests a periodic RBAC / least-privilege audit of the Zava Learning resource group — enumerate the real role assignments effective on the group, correlate each identity against actual Activity-Log usage to find standing access that is never used, flag over-privileged and directly-assigned (versus group-governed) identities and stale troubleshooting access, and recommend least-privilege corrections. Read-only; produces findings for a report.
03 SKILL.md 正文
Zava Learning — RBAC / Least-Privilege & Access-Usage Audit
Resource Group: @@RG@@. Read-only audit — never create, modify, or remove a role assignment.
This is a weekly governance review of who can do what here, and whether they actually use it. The
goal is real least-privilege hygiene: surface over-privileged identities, direct (ungoverned)
assignments, and standing access that has gone unused so a human can clean it up.
Identity naming policy (governance reports name their subjects)
The principals under audit (their display name / UPN / objectId and role) are the subject of this
report — show them; an RBAC finding that hides the identity is useless. This is NOT the learner-PII
the redaction standard protects. Still apply SearchMemory("zava-redaction") redact() to strip any
secrets, tokens, credentials, or learner/customer PII that happen to appear, and never print
secret values — but DO name the admins, service principals, and groups being audited.
Where the names come from (do NOT call Microsoft Graph): take the identity name from the
principalName field that az role assignment list already returns, plus principalType. Do not
run az ad user/group/sp list|show or az rest https://graph.microsoft.com/... to resolve names or
look up guest/enabled status — the SRE Agent's managed identity has no Graph directory-read
permission, so those calls fail with Insufficient privileges AND are gated as PendingAuthorization,
which would stall this unattended weekly run. If a principalName is blank, identify that principal by
its principalId (objectId) + principalType and note "display name unavailable (directory lookup not
permitted)". A UPN containing #EXT# (when present in principalName) still indicates a guest.
1. Enumerate the real assignments effective on the RG
- All assignments scoped at or above the RG (this includes subscription/management-group inheritance —
most access here is inherited):
az role assignment list --scope /subscriptions/<sub>/resourceGroups/@@RG@@ --include-inherited -o json. - For each: capture
principalName,principalType(User / Group / ServicePrincipal),roleDefinitionName,scope,description, andcreatedOnwhere present. These fields are sufficient — everything you need to name and classify a principal is already in this output; no follow-up directory calls.
2. Correlate against ACTUAL usage (the key step, BEST-EFFORT)
Standing access that is never exercised is the prime cleanup target. Pull who has actually operated in this RG and join it to the assignment list:
- The
-gserver-side filter on the activity log is unreliable here — query subscription-wide and filter client-side onresourceGroupName == @@RG@@. Use a bounded, valid query (the API rejects oversized requests with HTTP 400 "Bad Request"): a window of 30 days and--max-events 1000, e.g.az monitor activity-log list --start-time <UTC now-30d> --end-time <UTC now> --max-events 1000 -o json. If that still 400s, halve the window (e.g. 7-14 days) and/or add--query "[].{c:caller,r:resourceGroupName,t:eventTimestamp}". Then keep events whereresourceGroupNameis the RG; aggregate distinctcallervalues (these are UPNs or principal objectIds) with their last-seen timestamp. - A principal that holds a privileged role but appears as no caller in the window is standing-but-unused access → recommend removal / down-scoping. (Activity Log is control-plane, ~90-day retention; state the window you actually used and note data-plane-only usage may not appear.)
- Usage correlation is best-effort and MUST NOT block the report. If the activity-log query keeps
failing or returns nothing, do not retry indefinitely — after at most two adjusted attempts, record
"usage data unavailable (control-plane query limit / retention)" against the affected identities and
continue to the findings table and the branded deck using the assignment, scope, identity-type,
and
createdOn/descriptionsignals alone. Finishing the audit with a clear caveat is required; stalling on usage correlation is a failure. - Do not attempt Entra sign-in logs or any other Microsoft Graph query (e.g.
az rest https://graph.microsoft.com/...auditLogs/signIns) — the agent identity is not permitted and the call would stall on approval / fail. Base usage purely on the Activity Log window above.
3. Flag findings with impact-based severity (see zava-audit-report model)
- SEV1 — Owner / User Access Administrator / Contributor held directly by a User (not via a
group), especially with no usage in the lookback window; any privileged role on a guest
(
#EXT#inprincipalName) or orphaned principal; a clearly temporary / break-glass grant still present (telltaledescriptionlike "temp", "break-glass", "INC-####", "troubleshooting", or an oldcreatedOn). - SEV2 — an identity assigned broader scope than needed (privileged role at subscription/MG scope when only this RG is used), or a privileged role with stale usage (used long ago, not recently); a direct privileged grant that should be group-governed and PIM-eligible.
- SEV3 — non-privileged direct assignment that should be group-governed; duplicate / redundant assignments; a standing role that should be converted to a PIM eligible (just-in-time) assignment.
4. Recognise legitimate platform identities (avoid false positives)
This subscription carries first-party security & governance service principals — do not flag them as
risky; acknowledge them as expected. These include Microsoft Defender for Cloud, Azure Policy /
remediation, AzSecPack, Wiz (Wiz*), Illumio, Connected Machine / Arc, Backup / Recovery Services,
and the SRE Agent's own managed identity and the platform's user-assigned identity (AcrPull, Key Vault
Secrets User, Network Contributor for the agent). Note them in an "expected platform identities"
appendix rather than the findings table. Focus the findings on human users and non-platform
principals.
5. Produce the findings + recommendations
One row per finding:
Identity (type) · Role · Scope (direct/inherited) · Governance (direct/group) · Last used · Finding · Severity · Recommendation.
Sort SEV1 → SEV3. Recommendations should be concrete least-privilege moves: remove unused standing
access; replace a direct user grant with membership in a governed group; convert standing
privileged grants to PIM eligible (JIT); down-scope from subscription to the specific RG/resource;
remove stale break-glass access. Also produce a posture summary (Healthy / Needs attention / At risk,
counts by severity, # of identities with privileged-but-unused access, the single most important
action). Cite Azure least-privilege / PIM guidance via microsoft-learn_microsoft_docs_search.
6. Hand off to the branded report
This skill does not remediate. Pass the posture summary, the findings rows (each with its severity),
and the recommendations to the zava-audit-report skill, which renders the single branded,
downloadable PowerPoint deck and returns its download link. Surface that link to the operator.
04 同仓库更多 Skills
Zava 事件分析报告生成
zava-reporting
用于将已完成的 Zava Learning 事件分析打包呈现给受众。首先呈现带品牌标识的线程内执行摘要(内联前后对比视觉效果的 markdown),然后生成可下载的交付物——PowerPoint 演示文稿、HTML 电子邮件和 Teams 通知,使用 Zava 企业模板。调用的 agent 可将其缩小为子集(例如仅 HTML 报告)。产出内容和工件;它不负责发送。组装 rca-analysis、evidence-before-after、recommendations-next-steps 和 pr-delivery 的输出。
Zava 治理审计报告生成
zava-audit-report
用于将已完成的 Zava Learning 每周治理审计(NSG/网络安全、RBAC/最小权限或云成本)打包成一份采用 Zava 企业风格、带品牌标识的可下载 PowerPoint 演示文稿。调用的审计 agent 传入其发现结果(带严重级别的条目列表)和简短的安全态势摘要;本技能渲染演示文稿、应用脱敏处理,并返回附件下载链接。产出工件本身;它不负责发送。
ServiceNow 变更请求管理
servicenow-change-management
当 Zava Learning 调查产生了需要变更管理的持久性修复时使用——在为基础设施即代码或应用代码的根本原因打开 GitHub PR 之后,提出引用该 PR 的 ServiceNow 变更请求并附上 RCA 报告。是 ServiceNow 变更请求及附件操作的唯一负责方。
敏感信息脱敏
redaction-guard
每当要输出操作员可见的内容时使用——聊天/话题消息、PagerDuty 或 ServiceNow 记录、提交信息或拉取请求正文,或任何报告制品(HTML、PowerPoint、Teams 卡片)。确定性地屏蔽密钥、凭证、令牌、私钥、URI 中嵌入的密码以及个人身份信息(PII),确保它们不会出现在对话或任何交付物中。这是一项横切护栏,由产生输出的技能调用,而非一个操作手册步骤。
事件改进建议
recommendations-next-steps
用于为 Zava Learning 事件生成前瞻性的建议和后续步骤——包括按优先级排序的预防性、检测性和流程性行动,并附带负责人、目标日期和不采取行动的风险。其输出用于 zava-reporting 交付物。
事件根因分析
rca-analysis
用于为已解决或已缓解的 Zava Learning 事件生成根因分析叙述——包括事件时间线、触发因素与潜在根因(5-Whys)、促成因素以及如何呈现这些内容。定义 RCA 章节格式;其输出用于前后对比、建议和报告等交付物。