TypeError:&quot&quot' adgroup'&quot对象不可订阅

发布于 2025-02-10 22:55:36 字数 870 浏览 1 评论 0原文

  1. 使用Python SDK在Azure中创建AD组后,什么是ADGROUP类型,
  2. 如何获取Object_ID或将其存储在列表中,
  3. 我想使用Azure Python SDK创建多个组,以JSON格式传递组名称,我想获得输出并将信息存储在JSON中,但它引发了我在标题中所述的错误
from azure.common.credentials import ServicePrincipalCredentials
from azure.graphrbac import GraphRbacManagementClient
from azure.graphrbac.models import GroupCreateParameters
import json

jsonfile = open('csvjson.json')
data = json.load(jsonfile)

credentials = ServicePrincipalCredentials(
client_id = "",
secret = "",
tenant = "",
resource = 'https://graph.windows.net')

tenant_id = ""

graphrbac_client = GraphRbacManagementClient(
    credentials,
    tenant_id
)
groupdict = []
for i in data:
    group = graphrbac_client.groups.create(GroupCreateParameters(display_name=i['Group Name'], mail_nickname=i['Mail Nick Name']), raw=False)
    print(type(group))
    
  1. what is ADGroup type
  2. after creating the AD group in azure using python sdk how to fetch the object_id or store that in a list
  3. im trying to create multiple groups using azure python sdk, passing the group name in json format, i would like to obtain the output and store the info in a json but it throw the error which i have stated in the Title
from azure.common.credentials import ServicePrincipalCredentials
from azure.graphrbac import GraphRbacManagementClient
from azure.graphrbac.models import GroupCreateParameters
import json

jsonfile = open('csvjson.json')
data = json.load(jsonfile)

credentials = ServicePrincipalCredentials(
client_id = "",
secret = "",
tenant = "",
resource = 'https://graph.windows.net')

tenant_id = ""

graphrbac_client = GraphRbacManagementClient(
    credentials,
    tenant_id
)
groupdict = []
for i in data:
    group = graphrbac_client.groups.create(GroupCreateParameters(display_name=i['Group Name'], mail_nickname=i['Mail Nick Name']), raw=False)
    print(type(group))
    

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文