Allow users to restrict an az login session to one resource group or resource
维护者通常 1 天内回复
@isra-fel 已经在做这个了。
开始于 2026年10月3日。
评估
这个 Issue 还没有评估数据。
描述
Related command
az login
Suggested syntax below is illustrative, not an existing option.
Is your feature request related to a problem? Please describe.
My Azure user has legitimate access to several resource groups, including production systems. When working on development, I would like that specific login session to only have access to the development group.
This would be useful for ordinary terminal work, scripts, automation and agents. My account needing production access does not mean every work session I have needs it.
Read-only mode does not solve this. I need to write within the selected group, AND prevent reads of sensitive resources outside it.
Describe the solution you'd like
Could az login let a user voluntarily narrow their existing permissions for one session, without administrator collaboration or changes to their normal role assignments?
For example:
az login --restrict-to \
"/subscriptions/<subscription-id>/resourceGroups/development"
Then ordinary commands would behave like this:
# Allowed if my user already has the required permissions.
az storage blob upload \
--account-name devstorage \
--container-name test \
--name example.txt \
--file ./example.txt \
--auth-mode login
# Blocked because production is outside this session's scope.
az group show --name production
# Also blocked.
az group delete --name production
Resource-group scoping would already take us pretty far. Ideally, the same approach could allow selecting an individual resource within a group.
The restriction should be tied to the session's credentials and enforced by Azure. Changing command arguments, configuration or using the token directly should not bypass it. It should only reduce existing access, never grant additional permissions.
Describe alternatives you've considered
- A separate identity with scoped RBAC. That can work, but requires provisioning another identity and permission assignments rather than simply narrowing my current login.
- Storage SAS tokens. Useful for specific storage tasks, but not a general solution for Azure resource management.
- Default resource groups, shell wrappers and instructions to agents. These help avoid mistakes, but do not restrict what the credentials can access.
Additional context
This is a general CLI safety feature, not specifically an agent identity or MCP request. Agents are one use case where limiting the consequences of mistakes matters.
The restricted workflow should not silently fall back to unrestricted credentials. Other broad credentials accessible on the machine would still need to be kept away from the script or agent.
I am not sure whether Azure's existing authorization APIs support this. Could someone familiar with CLI authentication clarify whether it is feasible today, or which underlying Azure capability would be needed?
Related: #32974, global read-only mode. This request differs because it allows writes within the selected scope while also blocking sensitive reads outside it.
- 主要语言
- Python
- 星标
- 4.7k
- 派生
- 3.5k
- 平均合并
- 4 天 14 小时
- 30 天内合并 PR
- 92
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Azure/azure-cli 的其他 Issue
-
customer-reported MySQL needs-triage Service Attention
难度 1/5 1 小时以内 新手友好度 70/100
Azure/azure-cli#34393 · 5 条评论 ·
维护者通常 1 天内回复
-
customer-reported Service Attention
难度 1/5 1 小时以内 新手友好度 72/100
Azure/azure-cli#34267 · 1 条评论 ·
维护者通常 1 天内回复
-
Add support for cli completion in git bash for windows可能已有人在做 @a0x1ab 于 23 天前认领。 未关闭customer-reported Service Attention
难度 2/5 1-3 小时 新手友好度 68/100
Azure/azure-cli#34150 · 4 条评论 ·
维护者通常 1 天内回复
-
act-observability-squad Auto-Assign ContainerApp Output Service Attention
难度 2/5 1-3 小时 新手友好度 72/100
Azure/azure-cli#33149 · 5 条评论 ·
维护者通常 1 天内回复
-
act-codegen-extensibility-squad Auto-Assign Documentation MySQL Possible-Solution Service Attention Similar-Issue
难度 1/5 1 小时以内 新手友好度 85/100
Azure/azure-cli#33009 · 5 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
Unknown stop ID in slow zone data crashes post formatting and skips the rest of that day's posts未关闭backend bug tm-new-volunteer
难度 2/5 1-3 小时 新手友好度 84/100
transitmatters/mbta-slow-zone-bot#81 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
spacetelescope/rdmt-spire#49 ·
维护者通常 1 天内回复
-
AI bug
难度 2/5 1-3 小时 新手友好度 68/100
AUTO-MAS-Project/AUTO-MAS#1960 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
btclib-org/btclib-wallet#872 ·
维护者通常 1 天内回复