Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 1.03 KB

File metadata and controls

43 lines (33 loc) · 1.03 KB

FastAPI as Azure function

Minimal example of FastAPI deployed as Azure function.

Project structure

fastapi-azure-function
├── function/                                       Azure function and FastAPI code
├── infra/                                          Terraform code
├── .gitignore
└── README.md

Prerequisites

  • Azure Credentials: You'll need an Azure account with the necessary permissions to create the resources for the Azure function.
  • Azure CLI: Install Azure CLI.
  • Terraform: Install Terraform.

Deploy to Azure

Login to Azure and change to infra-directory.

az login
cd infra

Initialize Terraform.

terraform init

Terraform plan.

terraform plan

Terraform apply.

terraform apply

Terraform apply will output the URL of your deployed function, for example https://function-app-5aia.azurewebsites.net. In browser navigate to FastAPI docs https://function-app-5aia.azurewebsites.net/docs. From there you can send test requests to each of the endpoints.