【发布时间】:2019-10-29 08:23:44
【问题描述】:
我正在使用Microsoft PowerShell Intune cmdlets 来查询配置设置以进行审计。尽管使用 AdminConsent 授予应用程序访问权限,但我无法连接没有管理员访问权限的帐户。我还明确地将我的用户添加到应用程序中,并且可以看到已授予“委托”访问权限。
我已使用管理员帐户成功连接到我的 Azure 环境:
Connect-MSGraph -AdminConsent
Get-DeviceManagement_DeviceCompliancePolicies
使用不是全局管理员的另一个帐户运行此操作时,我收到错误:
Get-DeviceManagement_DeviceCompliancePolicies : 401 Unauthorized
{
"error": {
"code": "UnknownError",
"message": "{\"ErrorCode\":\"Forbidden\",\"Message\":\"{\\r\\n \\\"_version\\\": 3,\\r\\n \\\"Message\\\":
\\\"An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 6407b0fa-a2fd-4564-8895-cc63b49e2201
但是,我可以看到,我的用户具有预期的委托访问权限,包括:
| Microsoft Graph | Delegated | Perform user-impacting remote actions on Microsoft Intune devices |
| ------------------------------ | --------- | ----------------------------------------------------------------- |
| Microsoft Graph | Delegated | Read and write Microsoft Intune devices |
| Microsoft Graph | Delegated | Read and write Microsoft Intune RBAC settings |
| Microsoft Graph | Delegated | Read and write Microsoft Intune apps |
| Microsoft Graph | Delegated | Read and write Microsoft Intune Device Configuration and Policies |
| Microsoft Graph | Delegated | Read and write Microsoft Intune configuration |
| Microsoft Graph | Delegated | Read and write all groups |
| Microsoft Graph | Delegated | Read directory data |
| Microsoft Graph | Delegated | Sign users in |
| Windows Azure Active Directory | Delegated | Sign in and read user profile |
| Windows Azure Active Directory | Delegated | Read all groups |
documentation 没有什么帮助,尽管引用了我遇到的特定错误(“您的租户凭据支持管理功能。”)。目前还不清楚是否可以使用只读帐户来收集数据。
【问题讨论】:
-
每个租户只能调用
Connect-MSGraph -AdminConsent一次。要调用 API,您应该使用Connect-MSGraph(即不使用AdminConsent)。 -
@MarcLaFleur - 谢谢 - 明确地说,我确实在管理员同意的情况下运行过一次(为了允许应用程序),随后的调用在没有这个的情况下运行 - 不幸的是,这并不能解决我的问题尽管。我怀疑这实际上可能是我对 Azure Intune 的访问权限的其他地方的问题 - 但很难看到指定访问权限的位置
-
请记住,您不能通过 Graph 授予比用户自己可以做的更广泛的权限。因此,如果您的用户无法管理 Intune,它也将无法使用 Graph/PowerShell 来执行此操作。
标签: powershell microsoft-graph-api