Forum Discussion
skandhw
Oct 24, 2025Occasional Reader
Establish an Oracle Database Connection hosted on Azure VM via AI Foundry Agent
I have came across a requirement to create a AI Foundry agent that will accept requests from user like below: a. "I want to connect to abcprd database hosted on subscription sub1, and resource group...
AnjaliSadhukhan
Microsoft
Mar 25, 2026do try if helps-
- Build a Custom Function Tool (API Layer)
- Deploy an Azure Function or containerized API on the same VNet as your Oracle VM.
- Use python-oracledb or cx_Oracle to connect to the database.
- Store Oracle credentials in Azure Key Vault (access via Managed Identity — never hardcode).
- Knowledge Base for SQL Templates
- Store your query templates (AWR, V$SESSION, V$LOCKED_OBJECT, RMAN status, etc.) in Azure AI Search or Blob Storage.
- Agent retrieves the right template based on user intent, then parameterizes it with date/time/DB name.
- Agent Flow
- User prompt → Agent extracts intent + parameters → Calls function tool → Tool connects to Oracle DB, runs query → Returns results → Agent analyzes/summarizes via GPT-4.1.
- Key Security & Design Points
- Use VNet integration / Private Endpoints — no public DB exposure.
- Oracle user should be read-only (SELECT grants only).
- Use parameterized queries to prevent SQL injection.
- Use connection pooling to avoid per-request overhead.
- For large AWR reports, extract key sections (Top SQL, Wait Events, Load Profile) before passing to the LLM to stay within token limits.