Skip to content

Aviat-at/Azure-HTTP-Function-Sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure HTTP Function Sample

A minimal Azure Functions project demonstrating an HTTP-triggered endpoint that responds with a friendly greeting. The project includes a CI/CD pipeline for packaging and deploying to Azure Functions.

🚀 Features

  • HTTP-triggered Azure Function returning a customizable greeting.
  • Minimal configuration using the Azure Functions programming model v2 for Python.
  • Azure Pipelines workflow to build and deploy the function app package.

🏗️ Architecture Overview

The repository uses the Azure Functions Python worker with a single HTTP-triggered function defined in function_app.py. The FunctionApp instance registers routes, while host.json configures host-level settings such as logging and extension bundle versions. CI/CD is managed through Azure Pipelines, which installs dependencies, zips the app, and deploys it to an Azure Function App using az functionapp deployment source config-zip.

🛠️ Tech Stack

  • Python 3.9
  • Azure Functions (Python worker)
  • Azure CLI (for deployment)
  • Azure Pipelines (CI/CD)

📂 Project Structure

.
├── azure-pipelines.yml      # CI/CD pipeline for build and deploy
├── function_app.py          # Azure Functions app and HTTP route
├── host.json                # Host-level configuration
├── requirements.txt         # Python dependencies
└── .vscode/extensions.json  # VS Code extension recommendations

⚙️ Installation

  1. Install Python 3.9.
  2. (Recommended) Create and activate a virtual environment.
  3. Install dependencies:
    pip install -r requirements.txt
  4. Install the Azure Functions Core Tools for local development and debugging.

🔑 Environment Variables

This sample uses no custom environment variables. Azure Functions provides built-in settings for the HTTP trigger. If deploying to Azure, ensure the following app settings are configured as needed:

  • FUNCTIONS_EXTENSION_VERSION (managed by Azure)
  • WEBSITE_RUN_FROM_PACKAGE=1 (set in the pipeline deployment step)

▶️ Running the App

Use Azure Functions Core Tools to start the local runtime:

func start

Then call the HTTP endpoint:

curl "http://localhost:7071/api/HttpTrigger?name=YourName"

Expected response:

Hello, YourName!

If no name is provided, the function responds with Hello, World!.

🧪 Testing

No automated tests are provided. You can manually exercise the function via cURL or an HTTP client.

🐳 Docker / Kubernetes

No Dockerfile or Kubernetes manifests are included. Deployment is handled via Azure Functions package deployment.

🔗 API Endpoints

Method Route Auth Level Description
GET /api/HttpTrigger Anonymous Returns a greeting using name query

📦 Deployment

Azure Pipelines (azure-pipelines.yml) builds and deploys the function:

  1. Use Python 3.9 on Ubuntu agent.
  2. Install dependencies and package the app into functionapp.zip.
  3. Publish the zip as a pipeline artifact.
  4. Deploy via Azure CLI by setting WEBSITE_RUN_FROM_PACKAGE=1 and calling az functionapp deployment source config-zip with the packaged artifact.

🧭 Roadmap / Future Improvements

  • Add automated tests for the HTTP trigger.
  • Parameterize greetings or support multiple languages.
  • Add environment-specific configuration for development and production.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages