다음을 통해 공유

Inquiry on Using "Grounding with Bing Search" Without Azure CLI in Node.js Environment

JAESUNG PARK 0 평판 포인트
2025-07-11T07:47:06.51+00:00

Dear Microsoft Azure Support Team,

We are currently operating a Node.js-based backend system that uses the following approach to integrate Bing Search with Azure OpenAI:

  • We use axios to call the Bing Search API and retrieve results,

Process and customize the results internally,

Then pass the refined content to Azure OpenAI for generating responses.

We are now looking to adopt the “Grounding with Bing Search” capability recently introduced. However, the official documentation primarily focuses on Python SDKs and assumes configuration via Azure CLI, which is difficult to adopt directly in our current stack.

We are seeking guidance on whether it is possible to integrate this new feature with minimal changes in our current environment, under the following conditions:


Our requirements and constraints:

We need to maintain a Node.js backend (Python or CLI-based workflows are not feasible for us).

We prefer not to use DefaultAzureCredential or Azure CLI, and instead call the service directly using HTTP (e.g., axios, curl).

Our main requirement is that AI responses include annotated source references from Bing grounding.

We want to avoid using Azure AD credentials (client ID, client secret, tenant ID), and would prefer to authenticate using only the agent API key if possible.

As a fallback, we are exploring the REST API approach, but it’s unclear:

What exactly is required as the “agent token” for authentication?

  How can we obtain or construct it in a purely HTTP-based flow?
  

What we would like to know:

Is there any official or alternative method to implement “Grounding with Bing Search” entirely within a Node.js environment?

Can this be done using only the agent’s API key, without relying on Azure CLI or AD-based credentials?

If we use a REST API approach, could you clarify:

What the agent access token refers to,

  How to obtain it,
  
     And whether any examples exist for calling the service using `curl` or `axios`?
     

We have already provisioned the necessary Bing Search and Azure OpenAI resources via the Azure Portal, and we have an Agent configured.

We would appreciate any sample code, documentation, or guidance that helps us move forward while keeping our environment lightweight and minimal.

Thank you in advance for your assistance.


Azure
Azure
Microsoft에서 관리하는 전 세계 데이터 센터 네트워크를 통해 애플리케이션과 서비스를 빌드, 배포, 관리하기 위한 클라우드 컴퓨팅 플랫폼 및 인프라입니다.
투표 {count}개

답변 1개

정렬 기준: 가장 유용함
  1. Aryan Parashar 3,685 평판 포인트 Microsoft 외부 직원 중재자
    2025-09-16T02:45:47.81+00:00

    Hi Jaesung,

    Yes, you can implement “Grounding with Bing Search” entirely within a Node.js environment. Documentation:

    https://learn.microsoft.com/en-us/azure/ai-foundry/agents/how-to/tools/bing-code-samples?pivots=javascript
    However, you must use Azure AD credentials (Entra ID Authentication) in the Node.js environment, as it cannot be used with only the agent’s API key.

    Currently, grounding with Bing Search requires authentication using Azure AD credentials, since it is only supported through agents that utilize Azure AD (Entra ID Authentication) for access. Documentation:
    https://learn.microsoft.com/en-us/rest/api/aifoundry/aiagents/#authentication

    When using the REST API approach, the access token can be obtained with the following steps in the VS Code terminal (or Azure CLI):

    Run az login with the correct subscription.

    Run the following command and copy the access token:

    az account get-access-token --resource "https://ai.azure.com"
    

    The output will look like this:

    {
      "accessToken": "<redacted JWT access token>",
      "expiresOn": "2025-09-16 08:41:54.000000",
      "expires_on": 1757992314,
      "subscription": "<subscription-id>",
      "tenant": "<tenant-id>",
      "tokenType": "Bearer"
    }
    

    Documentation:
    https://learn.microsoft.com/en-us/azure/active-directory-b2c/access-tokens

    If you don’t want your Node.js environment to fetch tokens directly from Azure, you can:

    Set up a separate backend service (running with proper Azure AD credentials).

    1. That separate backend service generates Entra ID access tokens at fixed intervals.
    2. The tokens are stored securely (e.g., storage, or your own backend).
    3. Your Node.js environment retrieves the token from storage and uses it in REST API requests.

    This way, the Node.js environment never directly interacts with Azure authentication, but still gets valid short-lived tokens for accessing the Agents with Grounding.

    Feel free to accept it as an answer.
    Thankyou for reaching out to the Microsoft QNA Portal.

    댓글 0개 설명 없음

답변

질문 작성자는 답변을 '승인됨'으로 표시하고, 중재자는 답변을 '추천됨'으로 표시할 수 있습니다. 이를 통해 사용자는 해당 답변이 작성자의 문제를 해결했다는 것을 알 수 있습니다.