App registration with client secret works on development box but not on production

Aabot 20 Reputation points
2024-03-06T20:42:31.56+00:00

I have an app with a development box and a production box. On the development box, I can successfully setup an App registration with a client secret to make Azure calls using the Azure SDK, i.e. @azure/identity.

But when I use the same key on the production box (same code and everything), I receive this exception in NodeJS:

Error in running "AZURE Inventory": Error: Error: "AuthenticationRequiredError: network_error: Network request failed at MsalClientSecret.handleError (.../node_modules/@azure/identity/dist/index.js:471:16) at MsalClientSecret.doGetToken (.../node_modules/@azure/identity/dist/index.js:3287:24) at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async Object.withSpan

....

I have looked through the Azure site to see if there is a security setting that needs to be set. The development box is my home machine and the production box is a cloud instance.

I am puzzled as to why this is happening. Any ideas of what to look it? I have double checked the subscriptionId, tenantId, clientId, and clientSecret multiple times and they match.

Thanks.

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,629 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Shweta Mathur 29,681 Reputation points Microsoft Employee
    2024-03-07T09:01:58.1866667+00:00

    Hi @Aabot ,

    Thanks for reaching out.

    This error occurs when the fetch call to the /token endpoint exceeds the allotted time. It indicates a potential network connection problem between your device and the /token endpoint, possibly arising from various factors.

    This is difficult to debug from our end as it's not an issue with the library. It as an issue with your environment. If you're making thousands of calls it is possible you're getting throttled by the server.

    Also, check if there are any network restrictions or version updates on the production box that might be blocking the authentication requests.

    Issue: Version of node is not upgraded in the production environment

    Resolution: As @Aabot mentioned,

    User's image

    Thanks,

    Shweta

    0 comments No comments

  2. Aabot 20 Reputation points
    2024-03-08T11:15:03.36+00:00

    Found the issue. On production, I had v14. I upgraded to v20 and the issue went away. Thanks.