Skip to main content

Azure Function App

It's a Platform-as-Service (PaaS) serverless computing service application that allows developers to build and deploy event-driven applications.

Why use Azure Function?​

Azure will take care of deployment, scaling, and maintennace of the servers so I can focus on writing codes.

Usage​

Use Azure function to create serverless APIs, Building scalable web APIs. To reduce cost, I will use on-prem SQL and Hybrid Connection Manager (HCM) instead of having a cloud Azure SQL instance.

Coupled with a Hybrid Connection Manager (Download and install it on-prem server that can reach SQL), it can bridge between on-prem network and the Azure Function.

Advantage: No need to open inbound portt, it uses outbound TCP 443 (HTTPS) *** Hybrid Connections are only offered in Basic + pricing SKUS.

Let's create serverless APIs using Azure Function App​

My language of choice to build the servless API is JS.

const sql = require('mssql');
const config = {
user: 'myuser',
password: 'mypassword',
server: 'MySQLServer.domain.local', // same as Endpoint Host in step 3
database: 'MyDatabase',
options: {
encrypt: true,
trustServerCertificate: true
}
};

module.exports = async function (context, req) {
try {
await sql.connect(config);
const result = await sql.query`SELECT TOP 10 * FROM Employees`;
context.res = { body: result.recordset };
} catch (err) {
context.log(err);
context.res = { status: 500, body: err.message };
}
};

App Settings (Configuration on Azure Function App)​

Azure Portal --> Function App --> Configuration --> Application Settings


SQL_CONNECTION=Server=MySQLServer.domain.local;Database=MyDatabase;User Id=myuser;Password=mypassword;

Deployment​

Deployment of web services is the process of packaging, configuring, and releasing APIs or web applications so they are accessible to users or other systems in a reliable, secure, and scalable way. It bridges development and production by turning code into a running service on cloud or server infrastructure.

What Deployment Typically Includes​

  • Build & package the service (code → artifact or container)
  • Configure environments (dev, test, prod)
  • Provision infrastructure (compute, networking, storage)
  • Release & version the service
  • Monitor & scale based on usage

Common Deployment Approaches​

  1. Platform-as-a-Service (PaaS) Deploy code directly to managed platforms like Microsoft Azure App Service. Best for: speed, minimal infrastructure management, enterprise apps.

  2. Containers Package services in Docker and run them via orchestrators like Kubernetes. Best for: microservices, portability, high scalability.

  3. Serverless Deploy event-driven services using platforms like Azure Functions. Best for: lightweight APIs, background jobs, cost efficiency.