Microsoft Teams Collector fails with error 'The server returned an unexpected status code and no error factory is registered for this code: 402'

book

Article ID: 1000614031

calendar_today

Updated On:

Description

Error Message

The following is seen in the log file when the Logging level is set to Trace under Settings in the collector configuration. 

TRACE TraceLogger - [Response] [325304fc95] {"error":{"code":"PaymentRequired","message":"User 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx' needs a valid license to access this API. Visit https://docs.microsoft.com/en-us/graph/teams-licenses for more details.","innerError":{"date":"2023-09-22T14:58:41","request-id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx","client-request-id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"}}}

This is followed by the 402 warning: 

WARN  MsGraphClientApi.MsGraphClient - Request failed. Reason: Microsoft.Kiota.Abstractions.ApiException: The server returned an unexpected status code and no error factory is registered for this code: 402

Cause

The required E5 license is missing on the Azure side.

 

Resolution

Use the following steps to validate and resolve the issue.  
  1. Collect Trace level importer logs.
  2. Identify the error message in the logs.
  3. Check if the required E5 license is present on the Azure side.
  4. If the license is missing, obtain the license and associate it with the app.
  5. Verify if the issue is resolved.
  6. Reset Logging level back to the original value of Info

 

Issue/Introduction

Microsoft Teams collection is failing to collect items and the error below is seen in the Importer log file.