Skip to content

jishnuap/sql-query-runner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQL Query Runner Azure Function (.NET 8)

This project is an Azure Function App built with .NET 8 that exposes an HTTP endpoint for running SQL queries against a SQL Server database. It is designed for integration with AI agents or other automated systems.

Features

  • HTTP-triggered Azure Function
  • Accepts SQL queries via POST requests
  • Connects to SQL Server using a connection string from configuration
  • Returns query results or error details as JSON

Getting Started

Prerequisites

  • .NET 8 SDK
  • Azure Functions Core Tools
  • SQL Server instance

Local Development

  1. Clone the repository:
    git clone https://github.com/jishnuap/sql-query-runner.git
    cd sql-query-runner
  2. Set the SQL Server connection string in local.settings.json:
    {
      "IsEncrypted": false,
      "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet",
        "SqlConnectionString": "Server=YOUR_SERVER;Database=YOUR_DB;User Id=YOUR_USER;Password=YOUR_PASSWORD;"
      }
    }
  3. Run the function locally:
    func start

Usage

Send a POST request to the function endpoint with a JSON body:

{
  "query": "SELECT TOP 10 * FROM YourTable"
}

Response will be JSON with either results or error details.

Deployment

Follow Azure Functions deployment documentation to deploy to Azure.

License

MIT


For more details, see the source code and comments.

About

A generic function app that can be deployed in azure.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages