问题描述

使用China Azure,通过Azure CLI 创建AAD组报错,提示权限不足 Insufficient privileges to complete the operation

# 使用这个登录:
az login --service-principal --username xxx--password xxx--tenant xxx #执行 az ad group create
az ad group create --display-name GroupTestAdministrator --mail-nickname azuretest

问题解决

为了查看更完整的错误信息,在 az ad group create 命令中添加 --debug 参数,用于输出完整的日志信息:

$ az ad group create --debug --display-name GroupTestAdministrator --mail-nickname azuretest
cli.knack.cli: Command arguments: ['ad', 'group', 'create', '--debug', '--display-name', 'GroupTestAdministrator', '--mail-nickname', 'azuretest']
cli.knack.cli: __init__ debug log: ... ...
urllib3.connectionpool: Starting new HTTPS connection (1): graph.chinacloudapi.cn:443
urllib3.connectionpool: https://graph.chinacloudapi.cn:443 "POST /xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/groups?api-version=1.6 HTTP/1.1" 403 219
msrest.http_logger: Response status: 403
msrest.http_logger: Response headers:
... ...
msrest.exceptions: Insufficient privileges to complete the operation.

查看以上错误日志,最主要的信息是在请求接口 https://graph.chinacloudapi.cn 时,报错403。而 graph.chinacloudapi.cn 是使用的旧的Azure AD Graph终结点。现在新的为 Microsoft Graph(https://microsoftgraph.chinacloudapi.cn/)。

Azure Active Directory (Azure AD) Graph 已弃用,将于近期停用。 作为此弃用路径的一部分,现在已禁用通过Azure 门户向应用注册添加 Azure AD Graph 权限。

为应用注册配置所需的 Azure AD Graph 权限:https://learn.microsoft.com/zh-cn/graph/migrate-azure-ad-graph-configure-permissions

所以,根据此文的介绍,如要继续使用 az ad group create  创建AD Group,可以修改注册应用的清单权限,来实现赋权。详细步骤见:https://learn.microsoft.com/zh-cn/graph/migrate-azure-ad-graph-configure-permissions#option-2-update-the-application-manifest-on-the-azure-portal

第一步:获取到AAD应用 Windows Azure Active Directory 或 00000002-0000-0000-c000-000000000000 下的所有Role ID。

通过Azure CLI指令: az ad sp show --id 00000002-0000-0000-c000-000000000000 , 过滤出结果zhozho能够的 Role ID。

第二步: 在AAD的注册应用中,通过清单,找到requiredResourceAccess,将 00000002-0000-0000-c000-000000000000 中获取的所有权限,以下表的方式 添加到当前 注册应用的清单中。

"requiredResourceAccess": [
{
"resourceAppId": "00000002-0000-0000-c000-000000000000",
"resourceAccess": [
{
"id": "a42657d6-7f20-40e3-b6f0-cee03008a62a",
"type": "Scope"
},
{
"id": "5778995a-e1bf-45b8-affa-663a9f3f4d04",
"type": "Scope"
},
{
"id": "78c8a3c8-a07e-4b9e-af1b-b5ccab50a175",
"type": "Scope"
},
{
"id": "6234d376-f627-4f0f-90e0-dff25c5211a3",
"type": "Scope"
},
{
"id": "970d6fa6-214a-4a9b-8513-08fad511e2fd",
"type": "Scope"
},
{
"id": "311a71cc-e848-46a1-bdf8-97ff7156d8e6",
"type": "Scope"
},
{
"id": "c582532d-9d9e-43bd-a97c-2667a28ce295",
"type": "Scope"
},
{
"id": "cba73afc-7f69-4d86-8450-4978e04ecd1a",
"type": "Scope"
},
{
"id": "5778995a-e1bf-45b8-affa-663a9f3f4d04",
"type": "Role"
},
{
"id": "78c8a3c8-a07e-4b9e-af1b-b5ccab50a175",
"type": "Role"
}
]
},
{
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"resourceAccess": [
{
"id": "8b010b06-ce5b-41ce-bc8b-fa9acdb14371",
"type": "Scope"
}
]
}
],

参考资料

更新Azure 门户上的应用程序清单 : https://learn.microsoft.com/zh-cn/graph/migrate-azure-ad-graph-configure-permissions#option-2-update-the-application-manifest-on-the-azure-portal

【Azure 环境】使用 az ad group create 时候遇见 Insufficient privileges to complete the operation的更多相关文章

  1. Use Windows Azure AD to create SSO projects

    Keywords Windows Azure AD, SSO Summary Use Windows Azure AD to create SSO projects Detailed Scenario ...

  2. 【Azure 环境】使用Microsoft Graph PS SDK 登录到中国区Azure, 命令Connect-MgGraph -Environment China xxxxxxxxx 遇见登录错误

    问题描述 通过PowerShell 连接到Microsoft Graph 中国区Azure,一直出现AADSTS700016错误, 消息显示 the specific application was ...

  3. ASP.NET 在 Windows Azure 环境中使用基于 SQLServer 的 Session

    Session 嘛,占一点儿服务器资源,但是总归比 ViewState 和 Cookie 安全点儿,所以还是要用的. Windows Azure 环境中的 Web 服务器经由负载均衡调度,根本无法保证 ...

  4. Azure环境中Nginx高可用性和部署架构设计

    前几篇文章介绍了Nginx的应用.动态路由.配置.在实际生产环境部署时,我们需要同时考虑Nginx的高可用性和部署架构. Nginx自身不支持集群以保证自身的高可用性,商业版本的Nginx+推荐: T ...

  5. 部署Azure环境Web应用程序不能直接访问JSON文件解决方案

    问题: 部署在Azure环境Web应用程序的JSON文件,直接通过浏览器或Web应用访问出现 404 的错误信息. 以下通过Firfox浏览器直接访问JSON文件返回的提示错误信息: “HTML 文档 ...

  6. 【Azure 环境】连接到微软云Azure中国区 By VS 2019, VS Code, Powershell

    问题情形 最近,在使用最新的VS Code插件连接到中国区的Azure时候,出现了依旧是global版的登录连接.这个问题是当前Azure Account插件最新版的问题,可以使用V0.8.11版本登 ...

  7. 【Azure 环境】【Azure Developer】使用Python代码获取Azure 中的资源的Metrics定义及数据

    问题描述 使用Python SDK来获取Azure上的各种资源的Metrics的名称以及Metrics Data的示例 问题解答 通过 azure-monitor-query ,可以创建一个 metr ...

  8. Create view failed with ORA-01031:insufficient privileges

    有时候在ORACLE数据库创建视图时会遇到:ORA-01031:insufficient privileges错误,我也多次碰到了各种创建视图出错的情况,很多时候也没有太在意,今天被一同事问起这个问题 ...

  9. oracle, create table, insufficient privileges

    SQL> exec pro_gz_day_report;          ORA-01031: insufficient privileges          ORA-06512: at & ...

  10. 【Azure 环境】在Windows系统中 使用Terraform创建中国区Azure资源步骤(入门级)

    Terraform(全称:Hashicorp Terraform )是一种开源工具,用于预配和管理云基础结构. 它将基础结构编入描述云资源拓扑的配置文件中. 这些资源包括虚拟机.存储帐户和网络接口等. ...

随机推荐

  1. dmidecode 查看内存以及硬件信息

    安装工具dmidecode 使用 1.查看内存槽及内存条 $ sudo dmidecode -t memory 2.查看内存的插槽数,已经使用多少插槽.每条内存多大 $ sudo dmidecode  ...

  2. pytest-logging打印日志

    这里就不多介绍了,直接copy代码 日志等级分为下面五种 debug 详细信息,调试问题时使用 info 事情按预期工作 warning 警告问题 error 严重的问题,软件不能执行一些功能 cri ...

  3. echarts去除坐标轴上的x和y轴

    通过 show:false控制手否显示 <!DOCTYPE html> <html lang="en"> <head> <meta cha ...

  4. 从零开始配置 vim(6)——缩写

    关于vim能快速编辑文本的能力,我们见识到了 operator + motion ,见识到了. 范式和宏.甚至可以使用命令来加快文本编辑.在后面我们又介绍了快捷键绑定来快速执行我们想要的操作.今天我们 ...

  5. 使用protobuf生成代码import包找不到

    protobuf使用import导入包找不到 前言 解决方案 protobuf使用import导入包找不到 前言 使用protobuf生成go代码,发现protobuf中一个import引用找不到 p ...

  6. nodejs连接mysql报错:throw err; // Rethrow non-MySQL errors TypeError: Cannot read property 'query' of undefined

    该问题的解决方案如下: win+R 输入cmd mysql -u root -p 输入密码进入到mysql 3.执行sql语句,将密码改成123456(自己可以记住的密码即可) alter user ...

  7. chrony客户端发送时间戳随机问题

    现象   使用centos8的chrony给本机同步时间时,发现客户端发送给服务器的NTP包中,transmit timestamp(T3)的时间戳是随机的,同时,服务器端收到客户端请求的包后,原封不 ...

  8. 分享四个实用的vue自定义指令

    v-drag 需求:鼠标拖动元素 思路: 元素偏移量 = 鼠标滑动后的坐标 - 鼠标初始点击元素时的坐标 + 初始点击时元素距离可视区域的top.left 将可视区域作为边界,限制在可视区域里面拖拽 ...

  9. 苹果正在测试新款Mac mini:搭载M3芯片 配备24GB大内存

    据悉苹果目前正在测试新的Mac机型,亮点是采用最新的M3芯片. 据报道,首款搭载M3芯片的设备应该是13英寸的MacBook Pro和重新设计的MacBook Air,Mac mini机型并不在名单上 ...

  10. 2000元内最超值游戏处理器!锐龙5 7500F首发评测:轻松超频5.6GHz游戏追平i5-13600K

    一.前言:首款不带核显的锐龙7000处理器 以往的桌面锐龙处理器,带核显型号的很少,而到了Zen4时代,此前已上市的锐龙7000系列处理器都集成了核显. 现在,AMD锐龙5 7500F来了,这是AMD ...