Any permissions are missing Azure RBAC vs Power shell?(是否缺少Azure RBAC与Power外壳之间的任何权限?)
问题描述
PowerShell命令‘az Role Assignment List--assignee User@Company.com--all’在PowerShell中提供结果,但对以下代码片段没有结果。
TokenCredential azureCliCredential = new AzureCliCredentialBuilder().build();
GraphServiceClient<Request> graphClient = GraphServiceClient.builder().authenticationProvider(new TokenCredentialAuthProvider(azureCliCredential)).buildClient();
AppRoleAssignmentCollectionPage appRoleAssignments = graphClient.users("objectid of user@company.com").appRoleAssignments().buildRequest().get();
System.out.println(appRoleAssignments);
推荐答案
它不起作用的原因是您正在尝试的两件事情在一起是为了不同的事情。
'az role assignment list --assignee user@company.com --all'
将获取Azure RBAC角色分配,即分配给用户用于管理Azure订阅的角色。
但是,AppRoleAssignmentCollectionPage appRoleAssignments = graphClient.users("objectid of user@company.com").appRoleAssignments().buildRequest().get();
获取为Azure AD中的应用程序分配给用户的角色。
若要使用代码获取Azure RBAC角色分配,您需要使用Azure SDK for Java
这篇关于是否缺少Azure RBAC与Power外壳之间的任何权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!