A Ukrainian pharmaceutical manufacturer now lets employees ask complex business questions in plain language directly within Microsoft Teams, receiving audited SQL-generated reports in seconds. Tieto Tech Consulting designed and deployed the private Azure OpenAI-powered bot for Darnytsia, using retrieval-augmented generation to bridge natural language and structured data. The integration eliminates the need for SQL expertise, accelerates decision-making, and maintains strict audit trails—all without exposing sensitive data to public AI models.
The bot that speaks business language
Darnytsia produces over 200 medications and operates across multiple divisions generating vast amounts of operational and financial data. Traditional reporting required trained analysts to write SQL queries, slowing down time‑to‑insight. The new Teams bot changes that. A marketing manager can type “What were the top‑selling antibiotics in the Kyiv region last quarter?” and receive a formatted report with a data table, chart, and a natural‑language summary.
Under the hood, Azure OpenAI interprets the intent of the question, constructs a relevant SQL query, runs it against Darnytsia’s data warehouse, and packages the results. Crucially, every step is logged for auditing—who asked what, when, which query was generated, and what data was returned. This satisfies rigorous pharmaceutical industry compliance requirements.
Why retrieval-augmented generation (RAG) makes the difference
A standard large language model can guess at SQL syntax, but it often hallucinates table names, joins, or filters. Retrieval-augmented generation (RAG) grounds the model in reality. The solution indexes Darnytsia’s database schemas, field descriptions, sample values, and predefined query templates. When a user asks a question, Azure Cognitive Search retrieves the most relevant schema snippets and examples, which are injected into the prompt context. The model then generates a query that reflects actual table structures, not educated guesses.
This approach dramatically improves accuracy while reducing the risk of invalid or dangerous SQL statements. The system also includes a validation layer that checks generated queries against syntax rules and authorization policies before execution. If the bot is unsure about a request—such as an ambiguous metric—it proactively asks the user to clarify, mirroring a human analyst.
Microsoft Teams as the single pane of glass
Microsoft Teams already serves as Darnytsia’s collaboration hub. Adding the analytics bot here eliminates context‑switching. Users can ask questions in a one‑on‑one chat or in a group channel; the bot responds with interactive Adaptive Cards that include tables, visualizations, and links to download the underlying data. Managers can pin the bot for quick access, and notifications can be set up to deliver scheduled reports automatically.
The Teams integration also simplifies identity and access management. Entra ID (formerly Azure Active Directory) authenticates each request, and row‑level security in the data source ensures that users only see data they’re authorized to see. A sales rep in the Odesa branch, for instance, cannot retrieve national‑level financial figures.
From words to SQL: the core pipeline
Turning free‑form text into reliable SQL requires multiple stages:
- Intent classification: First, the system determines if the user wants a simple fact (“How many units sold last month?”), a trend (“Show monthly sales growth for the past year”), or a comparison (“Compare revenue across product lines”). This drives the query structure.
- Schema retrieval: Azure Cognitive Search returns the most relevant database tables, column definitions, and sample joins. Recent user queries and popular reports are also indexed to boost relevance.
- Prompt engineering: The LLM receives a crafted prompt that includes the schema context, the user’s question, and explicit instructions to produce only valid SQL, with no explanatory text.
- Query generation and validation: The model outputs a SQL statement. A lightweight parser checks for forbidden operations (INSERT, DELETE) and confirms that referenced tables and columns exist. If validation fails, the system retries with more explicit schema hints.
- Execution and post‑processing: The query runs against the data warehouse (Azure Synapse Analytics or SQL Database). Results are transformed into JSON, then rendered as an Adaptive Card. Meanwhile, an audit log captures the entire transaction—original question, generated SQL, execution timestamp, user identity, and returned row count.
This pipeline runs entirely within Darnytsia’s Azure tenant, ensuring data sovereignty.
Audited reports: trust through transparency
Pharmaceutical regulations demand strict data lineage and change control. The audit module of the bot addresses this by storing immutable records in Azure Cosmos DB or Azure SQL. Each record includes:
- User principal name and department
- Original natural‑language input
- Generated SQL query
- Execution timestamp and duration
- Number of rows returned
- Links to the adopted schema version and cached search results
Compliance officers can later review any interaction, replay a query, or trace exactly how a report was produced. This transparency turns a black‑box AI into a governable business tool. The audit trail also helps the IT team fine‑tune the schema index and prompt templates by revealing which questions work well and which need improvement.
Keeping data private with Azure OpenAI
A key requirement for Darnytsia was that no proprietary data ever leaves its controlled environment. The public ChatGPT service was out of the question. Instead, the solution uses Azure OpenAI Service, which offers the same GPT‑4 models within a dedicated Azure subscription. Microsoft guarantees that prompts and completions are not used to retrain foundation models and are not accessible to other customers.
Furthermore, all components—search, database, bot app, and AI model—reside in a single Azure region, with data encrypted in transit and at rest. Network security groups and private endpoints keep the infrastructure isolated. The bot is deployed as a Teams app registered in the organization’s tenant, so no external parties can discover or invoke it.
The human impact at Darnytsia
Since the bot went live, the average time to answer an ad‑hoc business question has dropped from hours (or even days, if a report developer was busy) to under a minute. Sales managers now run their own competitive analyses before weekly meetings. Supply chain planners query stock levels across warehouses in real time, spotting bottlenecks early. The analytics team, freed from repetitive report generation, focuses on deeper predictive modeling.
Importantly, the bot has democratized data access. Employees who once hesitated to bother the analytics team now self‑serve, fostering a more data‑driven culture. Early feedback highlights the natural‑language summaries as a favorite feature—many users simply read the generated text without even looking at the underlying numbers.
What this means for enterprise analytics
The Darnytsia project illustrates a pattern that is gaining traction: conversational Business Intelligence (BI) grounded in an organization’s own data structures. Traditional BI tools like Power BI and Tableau offer natural‑language querying, but they often rely on predefined semantic models and can struggle with ambiguous or complex queries. The RAG‑powered approach, by contrast, dynamically interprets questions against the raw schema, making it more flexible and easier to maintain.
For Microsoft customers, the building blocks are all available: Azure OpenAI Service, Cognitive Search, Azure SQL or Synapse, Power Apps or Bot Framework for Teams. The Darnytsia case provides a blueprint that can be replicated across industries—finance, retail, logistics, healthcare—any sector where fast, trusted analytics are critical.
Challenges and considerations
Implementing such a system is not trivial. The schema index must be curated and kept up‑to‑date as databases evolve; stale schema information leads to incorrect queries. Prompt engineering requires iterative testing to balance creativity with precision. Organizations must also establish clear policies for data exposure: the bot will obey row‑level security only if the underlying data source enforces it. And the audit module adds storage costs and must be managed carefully to avoid becoming a compliance bottleneck.
Moreover, while the bot reduces the need for SQL skills, it does not eliminate the need for data literacy. Users still need to understand basic business metrics and ask questions that are actually answerable with available data. Change management and training are as important as the technology itself.
Tieto Tech Consulting’s role
Tieto Tech Consulting, a Microsoft partner with deep expertise in Azure AI and Modern Work solutions, architected the entire stack. The firm handled everything from initial data discovery and schema indexing to prompt optimization and Teams app packaging. They also built the audit dashboard that compliance officers use today. According to the limited public information, the project was completed within weeks, thanks to the reusable components Tieto had developed for similar clients.
The road ahead
Darnytsia plans to extend the bot with proactive insights. Instead of waiting for user questions, the system could monitor KPI thresholds and push alerts when, say, a regional sales trend deviates significantly from forecast. Integration with Outlook and Excel is also on the roadmap, enabling users to receive scheduled reports as formatted spreadsheets in their inbox.
On the industry level, we can expect more pharmaceutical and life‑sciences companies to adopt similar solutions, driven by the pressures of digital transformation and the increasing availability of secured AI services. As Microsoft continues to enhance Azure OpenAI and Teams extensibility, the barrier to entry will keep falling. The audited SQL bot is not just a novelty; it’s a glimpse into the future of enterprise analytics: conversational, contextual, and fully auditable.