繁体   English   中英

Microsoft Graph PowerShell 访问权限 - 401 未经授权

[英]Microsoft Graph PowerShell access permissions - 401 Unauthorized

我正在使用Microsoft PowerShell Intune cmdlet来查询配置设置以进行审计。 尽管使用 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                                                   |

尽管引用了我遇到的特定错误(“您的租户凭据支持管理功能。”),但文档并没有帮助。 目前尚不清楚是否甚至可以使用只读帐户来收集数据。

事实证明我没有足够的耐心——权限“启动”需要 24 小时。

我们遇到了这个问题,时间延迟不是问题。

在我们的案例中,根本原因是我们使用的服务帐户(用户对象)未在 Azure AD 中授予“Intune 管理员”角色,这是此处提到的先决条件: https://docs.microsoft.com/en -us/samples/microsoftgraph/powershell-intune-samples/intune-graph-samples/

添加该角色后,我们的 Intune cmdlet 立即开始工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM