{"id":15142589,"url":"https://github.com/gaur-abhay/fastapi-azurefunctions-deployment","last_synced_at":"2026-01-07T22:09:59.517Z","repository":{"id":257217535,"uuid":"857639901","full_name":"gaur-abhay/FastAPI-AzureFunctions-Deployment","owner":"gaur-abhay","description":"This repository demonstrates the deployment of a FastAPI application to Azure Functions using the v2 model. It serves as a hands-on learning project, showcasing how to integrate FastAPI with Azure's serverless platform, and covering the complete process from setup to deployment.","archived":false,"fork":false,"pushed_at":"2024-09-24T08:02:46.000Z","size":97,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T04:11:18.449Z","etag":null,"topics":["azure-functions","fastapi","python","serverless"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gaur-abhay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-15T07:45:03.000Z","updated_at":"2024-09-24T08:02:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"c80b9940-a78a-4074-9039-9ce485f03aa8","html_url":"https://github.com/gaur-abhay/FastAPI-AzureFunctions-Deployment","commit_stats":{"total_commits":17,"total_committers":2,"mean_commits":8.5,"dds":"0.23529411764705888","last_synced_commit":"ddf8454eac05708e5d1e6792007324cc9a5297ac"},"previous_names":["gaur-abhay/fastapi-azurefunctions-deployment"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaur-abhay%2FFastAPI-AzureFunctions-Deployment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaur-abhay%2FFastAPI-AzureFunctions-Deployment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaur-abhay%2FFastAPI-AzureFunctions-Deployment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaur-abhay%2FFastAPI-AzureFunctions-Deployment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gaur-abhay","download_url":"https://codeload.github.com/gaur-abhay/FastAPI-AzureFunctions-Deployment/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246368649,"owners_count":20766058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure-functions","fastapi","python","serverless"],"created_at":"2024-09-26T09:42:57.090Z","updated_at":"2026-01-07T22:09:59.433Z","avatar_url":"https://github.com/gaur-abhay.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cimg src=\"https://github.com/user-attachments/assets/c707f0af-cb44-492e-8ba8-d23046dec6c9\" alt=\"image\" width=\"40\" height=\"40\"/\u003e FastAPI Deployment to Azure Functions (Learning Project)\n\nThis repository demonstrates how to deploy a FastAPI application to **Azure Functions** using the v2 model with a `function_app.py` file. The goal of this project is to showcase the deployment process of a basic FastAPI app using Azure’s serverless computing capabilities.\n\n## 🔗 GitHub Repository\n[GitHub Repository Link](https://github.com/gaur-abhay/FastAPI-AzureFunctions-Deployment) \n\n## 📋Table of Contents\n- [About](#about)\n- [Prerequisites](#prerequisites)\n- [FastAPI Application Setup](#fastapi-application-setup)\n- [Creating an Azure Function](#creating-an-azure-function)\n- [Deploying FastAPI to Azure Functions](#deploying-fastapi-to-azure-functions)\n- [Testing the Deployment](#testing-the-deployment)\n- [What I Learned](#what-i-learned)\n- [Conclusion](#conclusion)\n- [References](#references)\n\n## 🌟About\n\nThis is a learning project aimed at showcasing the deployment process of a FastAPI application to Azure Functions. I am working on FastAPI-related tasks at Mila AI, and this project helps me apply and demonstrate my knowledge of deploying cloud applications, focusing on the serverless approach using Azure.\n\n![Azure Functions Deployment](\u003cADD_YOUR_IMAGE_URL_HERE\u003e)\n\n---\n\n## 🛠Prerequisites\n\nBefore starting, ensure you have the following:\n- **Azure CLI**: [Install Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli).\n- **Azure Functions Core Tools**: For running functions locally. [Install here](https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local).\n- **FastAPI \u0026 Uvicorn**: Install using:\n    ```bash\n    pip install fastapi uvicorn\n    ```\n\n---\n\n## \u003cimg src=\"https://github.com/user-attachments/assets/ff810adb-ad19-432d-94e4-281d0e27c0a9\" alt=\"image\" width=\"30\" height=\"30\"/\u003e FastAPI Application Setup\n\nOnce the FastAPI application code is set up with a basic structure, you'll need to ensure that it can handle HTTP requests when deployed as an Azure Function. The setup includes a simple FastAPI app with one or two routes to demonstrate the deployment.\n\nWe will use the v2 model of Azure Functions, which structures the project using a `function_app.py` file, eliminating the need for a `function.json` file.\n\n---\n\n## Creating an Azure Function\n\nNext, we’ll initialize the Azure Function and set up the HTTP trigger to route requests to our FastAPI app.\n\n1. Initialize a new Azure Function in your project directory:\n    ```bash\n    func init --worker-runtime python\n    ```\n\n3. Create an HTTP-triggered function:\n    ```bash\n    func new --name HttpTrigger --template \"HTTP trigger\" --authlevel \"anonymous\"\n    ```\n\n4. Modify `function_app.py` to route requests to FastAPI app (as given in codebase).\n\n---\n\n## 🚀Deploying FastAPI to Azure Functions\n\nDeploying the FastAPI app to Azure Functions involves the following steps:\n\n1. **Login to Azure** via CLI:\n    ```bash\n    az login\n    ```\n\n2. **Deploy the App**:\n\n   - First, create a ZIP file of your function app:\n     ```bash\n     zip -r function.zip .\n     ```\n\n   - Then, deploy the ZIP file to your Azure Function App:\n     ```bash\n     az functionapp deployment source config-zip --name \u003cYOUR_FUNCTION_APP_NAME\u003e --resource-group \u003cYOUR_RESOURCE_GROUP_NAME\u003e --src function.zip\n     ```\n\n![image](https://github.com/user-attachments/assets/1864296b-7a76-4a05-a5ba-8743bdd7505c)\n\n\n---\n\n## Testing the Deployment\n\nOnce deployed, you can test your FastAPI app by accessing the provided function URL.\n\n1. **Get the URL**:\n   The Azure CLI will output the URL for function app after deployment. It will look something like:\n   ```\n   https://\u003cYOUR_FUNCTION_APP_NAME\u003e.azurewebsites.net/HttpTrigger\n   ```\n\n2. **Test the API**:\n   Use `curl` or Postman to send a request to your FastAPI endpoint:\n   ```bash\n   curl https://\u003cYOUR_FUNCTION_APP_NAME\u003e.azurewebsites.net/HttpTrigger\n   ```\n\n   You should see a JSON response similar to:\n   ```json\n   {\n       \"message\": \"Hello from FastAPI deployed on Azure Functions!\"\n   }\n   ```\n\n![image](https://github.com/user-attachments/assets/0b4d52bb-a6e6-40a1-9873-9617e8b2a63b)\n\n\n---\n\n## 🧠What I Learned\n\nWhile working on this project, I gained hands-on experience with:\n- **Deploying FastAPI apps** to **Azure Functions** using the serverless model.\n- Understanding how **WSGI middleware** works to integrate FastAPI with Azure Functions.\n- Using **Azure CLI** for managing resources, creating Function Apps, and deploying applications.\n- Configuring FastAPI to work in a **serverless environment** with automatic scaling based on demand.\n\n---\n\n## 🎯Conclusion\n\nThis project serves as a demonstration of deploying a simple FastAPI application to Azure Functions using the v2 model. While this project focuses on the deployment process, it can be extended into a full-featured API in the future.\n\nFeel free to explore, contribute, or provide feedback on this repository!\n\n---\n\n## 🔗References\n\nThis project was built based on the official Microsoft Azure documentation. You can learn more about deploying Python apps on Azure Functions from the following resources:\n- [Azure Functions Python Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python)\n\n---\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaur-abhay%2Ffastapi-azurefunctions-deployment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgaur-abhay%2Ffastapi-azurefunctions-deployment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaur-abhay%2Ffastapi-azurefunctions-deployment/lists"}