首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >azure-sdk-python状态代码未找到GraphRbacManagementClient

azure-sdk-python状态代码未找到GraphRbacManagementClient
EN

Stack Overflow用户
提问于 2018-06-29 11:55:53
回答 1查看 167关注 0票数 0

我试图从azure订阅中枚举Azure AD用户,代码如下: WORKING_DIRECTORY = os.getcwd() TENANT_ID = "REDACTED_AZURE_ID_OF_MY_AZURE_AD_USER“AZURE_AUTH_LOCATION = os.path.join(WORKING_DIRECTORY," mycredentials.json ") # from: az ad sp create-for-rbac sdk-auth>mycredentials.json。

代码语言:javascript
复制
# I've tried with get_client_from_cli_profile() while logged in azure CLI
# I've tried with and without parameters auth_path and tenant_id
rbac_client = get_client_from_auth_file(GraphRbacManagementClient,auth_path=AZURE_AUTH_LOCATION, tenant_id=TENANT_ID)

# Try to list users
for user in rbac_client.users.list():
    pprint(user.__dict__)

正如我在评论中详细介绍的那样,我尝试用几次失败的尝试来解决这个问题,下面是堆栈跟踪

代码语言:javascript
复制
/home/guillaumedsde/.virtualenvs/champollion/bin/python /home/guillaumedsde/PycharmProjects/champollion/champollion/champollion.py
Traceback (most recent call last):
  File "/home/guillaumedsde/PycharmProjects/champollion/champollion/champollion.py", line 582, in <module>
    gitlab_project_member.access_level)
  File "/home/guillaumedsde/PycharmProjects/champollion/champollion/champollion.py", line 306, in create_role_assignment
    "principal_id": get_user_azure_id(user)}  # get_user_azure_id(user)}  # TODO
  File "/home/guillaumedsde/PycharmProjects/champollion/champollion/champollion.py", line 329, in get_user_azure_id
    for user in rbac_client.users.list():
  File "/home/guillaumedsde/.virtualenvs/champollion/lib/python3.6/site-packages/msrest/paging.py", line 131, in __next__
    self.advance_page()
  File "/home/guillaumedsde/.virtualenvs/champollion/lib/python3.6/site-packages/msrest/paging.py", line 117, in advance_page
    self._response = self._get_next(self.next_link)
  File "/home/guillaumedsde/.virtualenvs/champollion/lib/python3.6/site-packages/azure/graphrbac/operations/users_operations.py", line 158, in internal_paging
    raise models.GraphErrorException(self._deserialize, response)
azure.graphrbac.models.graph_error.GraphErrorException: Operation returned an invalid status code 'Not Found'

Process finished with exit code 1
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-07-03 20:07:19

是在azure-公共1.1.13 https://pypi.org/project/azure-common/1.1.13/中修复的一个bug

现在您可以简单地这样做了(没有租户ID)

代码语言:javascript
复制
rbac_client = get_client_from_auth_file(GraphRbacManagementClient,auth_path=AZURE_AUTH_LOCATION)

我也借此机会修正了这个方法的CLI版本。

(我在MS拥有这个代码)

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51101205

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档