Dear Jagan,
To resolve your issue with Azure AI Agent Service using OpenAPI tools and bearer token authentication, you’ll need to ensure two major things are handled properly:
1. Network Accessibility from Azure AI Agent Service
Azure AI Agent Service must be able to reach the internal Kubernetes service endpoint:
https://forms-tstnf-internal.eu.hrx.alight.com
Solution Options
:
- Use Azure VNet integration: Your agent must be deployed in a VNet-enabled environment (e.g., Azure Container Apps with VNet, or Azure Functions Premium Plan with VNet support).
- Private Endpoint or Internal DNS resolution must be available from the AI Agent’s execution environment.
- Consider exposing the API via Azure API Management (APIM) with VNet + Private Link to securely bridge public Azure AI services and internal Kubernetes-hosted APIs.
2. Dynamic Bearer Token Injection in Azure AI Agent Tool
The agent won’t automatically rotate or inject dynamic bearer tokens unless you use a proper Connection setup and secure Azure Managed Identity or custom connection logic.
Since you mentioned:
“Authentication method as (connection)”
You should follow this pattern using “connection” as a security method, not hardcoding bearer tokens directly in OpenAPI schema.
Steps to Use Dynamic Bearer Token with Connection Authentication
A. Modify OpenAPI Security Scheme (keep this)
"securitySchemes": {
"BearerAuth": {
"type": "apiKey",
"name": "Authorization",
"in": "header",
"description": "JWT Bearer token. Format: Bearer {token}"
}
}
B. Add Security Requirement
"security": [
{
"BearerAuth": []
}
]
C. Use Azure AI Agent Service’s Connection Feature
- In Azure AI Foundry, go to your tool → Connections tab
- Select “Add Connection” → Choose type “API Key”
- Set:
- Header Name: Authorization
- Header Value Template: Bearer {{token}}
-
- Replace {{token}} with a key vault reference or a logic app URL that returns a token dynamically
- Header Name: Authorization
D. Token Generation Options
If your API requires a short-lived JWT:
- Option 1: Use Azure Logic App or Azure Function to generate and return a fresh token.
- Option 2: Manually paste token in connection for now if automation is not in place.
E. Testing the Connection
In Azure AI Foundry Playground, test your agent with:
- Network access working (step 1 solved)
- Connection set with Authorization header using the live token
If this fails, the curl error should show the actual root cause:
- 403 → token issue
- 404 → wrong endpoint
- timeout or aiohttp client error → VNet/firewall issue
Summary Checklist
Task | Status |
---|---|
Task | Status |
Private API reachable from Azure AI Foundry? | Ensure via VNet, APIM, or Private Link |
OpenAPI securitySchemes defined correctly? | Yes |
Connection used for Authorization: Bearer {{token}}? | Must do |
Token rotation setup? | Optional but ideal |
Agent tool configured with the right connection? | Verify in Azure Portal |
Would you like me to provide:
- A sample Logic App that generates a bearer token dynamically?
- A diagram explaining how OpenAPI + Agent + connection works with VNet?
Let me know! To resolve your issue with Azure AI Agent Service using OpenAPI tools and bearer token authentication, you’ll need to ensure two major things are handled properly:
1. Network Accessibility from Azure AI Agent Service
Azure AI Agent Service must be able to reach the internal Kubernetes service endpoint:
https://forms-tstnf-internal.eu.hrx.alight.com
Solution Options
:
- Use Azure VNet integration: Your agent must be deployed in a VNet-enabled environment (e.g., Azure Container Apps with VNet, or Azure Functions Premium Plan with VNet support).
- Private Endpoint or Internal DNS resolution must be available from the AI Agent’s execution environment.
- Consider exposing the API via Azure API Management (APIM) with VNet + Private Link to securely bridge public Azure AI services and internal Kubernetes-hosted APIs.
2. Dynamic Bearer Token Injection in Azure AI Agent Tool
The agent won’t automatically rotate or inject dynamic bearer tokens unless you use a proper Connection setup and secure Azure Managed Identity or custom connection logic.
Since you mentioned:
“Authentication method as (connection)”
You should follow this pattern using “connection” as a security method, not hardcoding bearer tokens directly in OpenAPI schema.
Steps to Use Dynamic Bearer Token with Connection Authentication
A. Modify OpenAPI Security Scheme (keep this)
"securitySchemes": {
"BearerAuth": {
"type": "apiKey",
"name": "Authorization",
"in": "header",
"description": "JWT Bearer token. Format: Bearer {token}"
}
}
B. Add Security Requirement
"security": [
{
"BearerAuth": []
}
]
C. Use Azure AI Agent Service’s Connection Feature
- In Azure AI Foundry, go to your tool → Connections tab
- Select “Add Connection” → Choose type “API Key”
- Set:
- Header Name: Authorization
- Header Value Template: Bearer {{token}}
-
- Replace {{token}} with a key vault reference or a logic app URL that returns a token dynamically
- Header Name: Authorization
D. Token Generation Options
If your API requires a short-lived JWT:
- Option 1: Use Azure Logic App or Azure Function to generate and return a fresh token.
- Option 2: Manually paste token in connection for now if automation is not in place.
E. Testing the Connection
In Azure AI Foundry Playground, test your agent with:
- Network access working (step 1 solved)
- Connection set with Authorization header using the live token
If this fails, the curl error should show the actual root cause:
- 403 → token issue
- 404 → wrong endpoint
- timeout or aiohttp client error → VNet/firewall issue
Summary Checklist
Task | Status |
---|---|
Private API reachable from Azure AI Foundry? | Ensure via VNet, APIM, or Private Link |
OpenAPI securitySchemes defined correctly? | Yes |
Connection used for Authorization: Bearer {{token}}? | Must do |
Token rotation setup? | Optional but ideal |
Agent tool configured with the right connection? | Verify in Azure Portal |
Best Regards,
Jerald Felix