How to resolve the error: endpoints_resolution_error ?

Rajat 20 Reputation points
2023-12-22T15:26:25.2333333+00:00

https://learn.microsoft.com/en-us/azure/developer/javascript/sdk/authentication/on-premises-apps?toc=%2Fazure%2Fstorage%2Fblobs%2Ftoc.json&bc=%2Fazure%2Fstorage%2Fblobs%2Fbreadcrumb%2Ftoc.json&tabs=azure-portal

I followed this tutorial each and every step.

When I'm trying to run the below code, this is giving error:

const data = blobServiceClient.listContainers()for await (const container of data) {  console.log(container.name);}
{   "errorCode": "endpoints_resolution_error",   "errorMessage": "Endpoints cannot be resolved",   "subError": "",   "name": "ClientAuthError",   "correlationId": "79cde004-5375-43e5-8032-eef2057ee192" }

Please help me with what I'm doing wrong.

Azure Storage
Azure Storage
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

Answer accepted by question author
  1. Anand Prakash Yadav 7,865 Reputation points Microsoft External Staff
    2024-01-02T13:16:45.89+00:00

    Rajat, I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this!

    Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer. Accepted answers show up at the top, resulting in improved discoverability for others.
    User's image

    Issue: Customer unable to resolve the error: endpoints_resolution_error while following the steps in the document: https://learn.microsoft.com/en-us/azure/developer/javascript/sdk/authentication/on-premises-apps?toc=%2Fazure%2Fstorage%2Fblobs%2Ftoc.json&bc=%2Fazure%2Fstorage%2Fblobs%2Fbreadcrumb%2Ftoc.json&tabs=azure-portal

    Error Message:

    { "errorCode": "endpoints_resolution_error",  "errorMessage": "Endpoints cannot be resolved",  "subError": "",  "name": "ClientAuthError",  "correlationId": "79cde004-5375-43e5-8032-eef2057ee192" }
    
    

    Cause: Incorrect node version.

    Solution: Customer was using node version 14. After upgrading to node version 16, the issue got mitigated.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Dillon Silzer 60,711 Reputation points Volunteer Moderator
    2023-12-22T16:12:45.8666667+00:00

    Hi Rajat,

    Make sure you are filling in the proper blob storage link as see in new BlobServiceClient() below.

    // connect-with-default-azure-credential.js
    const { BlobServiceClient } = require('@azure/storage-blob');
    const { DefaultAzureCredential } = require('@azure/identity');
    require('dotenv').config()
    
    const accountName = process.env.AZURE_STORAGE_ACCOUNT_NAME;
    if (!accountName) throw Error('Azure Storage accountName not found');
    
    const blobServiceClient = new BlobServiceClient(
      `https://${accountName}.blob.core.windows.net`,
      new DefaultAzureCredential()
    );
    

    Just based on your information, If you are using the on-prem you may need to set up a private endpoint connection:

    Use private endpoints for Azure Storage

    https://learn.microsoft.com/en-us/azure/storage/common/storage-private-endpoints


    If tihsi s helpful please accept answer.


  2. Rajat 20 Reputation points
    2023-12-26T08:16:39.3133333+00:00

    Understood the issue. It happened because I was using node version 14. On using node version 16, it was working just fine.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.