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).
- That separate backend service generates Entra ID access tokens at fixed intervals.
- The tokens are stored securely (e.g., storage, or your own backend).
- 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.