This project is a demonstration of how Azure Functions can be used in combination with FastAPI.
Demo API with the following endpoints:
- Product
- Create
- Read all products
- Read a specific product
- Patch product data
- Delete a product
It should be noted that this is only a demo API. This API does not use a real database and therefore only uses a very simplified database manager with an "InMemory" database.
- Install the Azure Function Core Tools
- Python 3.9.0
- Azure Subscription (optional)
After that, create a python virtual environment, activate it and install the requirements.
func start --python
In order to start the Azure Function via the Azure Function Core Tools (CLI) a activated virtual environment is required.
After starting Azure Functions you can access the documentation via this link:
http://localhost:7071/docs
This step requires an Azure Account. In case you do not have an Azure Account you can go ahead and create an account for free here.
Deploy ARM template to a existing resource group:
az deployment group create --resource-group <resource-group> --template-file .\az-func-template.json --parameters appName='<your_app_name>' storageAcctName='<your_storage_account_name>' hostingPlanName='<your_hosting_plan_name>'
func azure functionapp publish <your_function_app_name>
The original ARM template can be obtained from this blog by Ben Keen.