Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jeffhollan/functions-python-cosmosdb-trigger
https://github.com/jeffhollan/functions-python-cosmosdb-trigger
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jeffhollan/functions-python-cosmosdb-trigger
- Owner: jeffhollan
- Created: 2020-04-18T15:57:02.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-05-01T21:37:56.000Z (over 1 year ago)
- Last Synced: 2025-01-23T00:45:11.568Z (5 days ago)
- Language: Python
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Azure Functions Python sample for CosmosDB
This project is a small extension of our quickstart: https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-azure-function-azure-cli?tabs=bash%2Cbrowser&pivots=programming-language-python
### Pre-reqs
1. Ensure you have the [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/?view=azure-cli-latest) on your machine (`az`) and logged in with your subscription `az login`.
2. Ensure you have the [Azure Functions core tools](https://github.com/Azure/azure-functions-core-tools#azure-functions-core-tools) (`func`) on your machine. This is used for project creation, debugging, and deploying.### How to start
1. Create a virtual environment
- Windows: `py -m venv env ; env\Scripts\Activate.ps1 ; pip install -r requirements.txt`
- Linux: `python3 -m venv env && source env\bin\activate && pip install -r requirements.txt`
2. Copy the connection string for your CosmosDB account and paste it into the value in `local.settings.json`
3. Update the metadata in `/CosmosTrigger/function.json` with the name of your database and collection for CosmosDB
4. Copy the connection string for an Azure Storage account and paste it into the value in `local.settings.json`
5. Run the app locally with `func start`, or open in VS Code with the "Azure Functions" extension and debug.### How to deploy
Follow the [instructions here](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-azure-function-azure-cli?tabs=bash%2Cbrowser&pivots=programming-language-python#create-supporting-azure-resources-for-your-function) to deploy. Your app should have 3 functions, `HttpExample`, `CosmosTrigger`, and `FlaskExample`