大网数据广告活动
域与目录服务

Tenant Doesn't Have Premium License When You Query User Sign-in Activities By Using Microsoft Graph

· 52CE 我爱测

Provides solutions to the either tenant is B2C or tenant doesn't have premium license error when you query user sign-in activities by using Microsoft Graph

This article discusses the error that occurs when you make Microsoft Graph API calls that are related to user sign-in activities or user registration details.

Symptoms

You run one of the following Microsoft Graph API calls:

GET https://graph.microsoft.com/v1.0/auditLogs/signIns

GET https://graph.microsoft.com/v1.0/users?$select=displayName,userPrincipalName,signInActivity

GET https://graph.microsoft.com/v1.0/reports/UserRegistrationDetails

After you run the call, your receive an error response that resembles the following text:

'error': {
    'code': 'Authentication\_RequestFromNonPremiumTenantOrB2CTenant',
    'message': 'Neither tenant is B2C or tenant doesn't have premium license',
    'innerError': {
        'date': '2021-03-04T07:53:51',
        'request-id': 'a0a074e6-xxx-c511669fa420',
        'client-request-id': 'a0a074e6-xxx-c511669fa420'
    }
}

Solution

Scenario 1: Query user sign-in activities

  1. Make sure that the target tenant has an Entra ID Premium P1 or P2 license. In the Azure portal, go to Microsoft Entra ID, select Overview, and then check the License value. For more information, see Sign up for Microsoft Entra ID P1 or P2 editions.
  2. Verify that the Microsoft Graph Access Token was granted the AuditLog.Read.All and Directory.Read.All permissions.

Scenario 2: Query credential user registration details

  1. Make sure that the target tenant has an Entra ID Premium P1 or P2 license.
  2. Verify that the Microsoft Graph Access Token was granted the Reports.Read.All permission.
  3. Verify that the authenticating user or the service principle of the application is in one of the following required administrative roles:
    • Reports Reader
    • Security Reader
    • Security Administrator
    • Global Reader
    • Global Administrator

More information

If an application is configured by using only the AuditLog.Read.All permission, this error might occur intermittently. This is expected behavior because the Directory.Read.All permission is required to retrieve tenant licensing information if it isn't already cached. To avoid this error, make sure that both permissions are included.

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors (upstream author metadata: bachoang). Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 04/25/2025
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。