Import sets getting cancelled with below error message

Harish13696
Tera Contributor

We are encountering an issue while executing the "Scheduled Data Imports" process in ServiceNow. The execution is being canceled with the following error message:


Error executing script : org.mozilla.javascript.JavaScriptException: Error: Unable to make a connection to Intune via Graph API call. Please check your credential configuration. Check system log for more details. HTTP return status code was 401 (sys_script_include.6a4e0342773310102dfb23446810611c.script; line 659)

Permissions & credentials are verified , everything looks good. Request assistance in identifying and resolving the root cause.

Thanks

11 REPLIES 11

Runjay Patel
Giga Sage

Hi @Harish13696 ,

 

Check below.

  1. Update Client Secret: If the client secret has expired, generate a new secret in Azure AD and update it in ServiceNow
  2. Check API Token Scope: Ensure the token being used has the necessary Graph API permissions. Test the token using tools like Postman or Curl.
  3. Debug Script Include: Add debug logging in the Script Include around line 659 to log the token, request payload, and API response.

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

We had update Client secret with new one and token is generating

 

Hi @Harish13696 ,

 

Did you check with Intune team + Network team that firewall is not blocking.

Ankur Bawiskar
Tera Patron
Tera Patron

@Harish13696 

is it happening all the time or intermittently?

Seems when the scheduled import ran at that time it was unable to connect and gave 401 error

401 means incorrect username and password or credentials.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader