This is a simple Azure function written in Python.
- Azure CLI installed and configured
- Azure subscription
- Python 3.8 or later
- Git (optional, for version control)
Ensure your project has the following structure before deployment:
learnazfunctions/
├── host.json # Host configuration file
├── requirements.txt # Python dependencies
└── hello_world/ # Function directory
├── __init__.py # Function code
└── function.json # Function configuration
az loginaz group create --name helloazfuncuks-rg --location uksouthaz storage account create \
--name helloazfuncukssa \
--location uksouth \
--resource-group helloazfuncuks-rg \
--sku Standard_LRSaz functionapp create \
--name helloazfuncuks \
--storage-account helloazfuncukssa \
--consumption-plan-location uksouth \
--resource-group helloazfuncuks-rg \
--os-type Linux \
--runtime python \
--runtime-version 3.12 \
--functions-version 4From the root directory of your project:
az functionapp deployment source config-zip \
--resource-group helloazfuncuks-rg \
--name helloazfuncuks \
--src ./deployment.zipNote: You need to create the deployment.zip first. You can do this with:
# Navigate to your function app directory
cd /path/to/learnazfunctions
# Create a deployment package
zip -r deployment.zip . -x "*.git*" "*.vscode*" "*.venv*" "__pycache__*"# Get the function URL
az functionapp function show \
--name helloazfuncuks \
--resource-group helloazfuncuks-rg \
--function-name hello_world \
--query invokeUrlTemplate \
--output tsvTest the function by visiting the URL in your browser or using curl.
-
Check function logs:
az functionapp logs tail --name helloazfuncuks --resource-group helloazfuncuks-rg
-
If deployment fails, ensure all required files are present and correctly formatted
-
Verify your Python version is compatible with Azure Functions
-
Check for any dependency issues in requirements.txt
To remove all resources when no longer needed:
az group delete --name helloazfuncuks-rg --yes- The storage account name must be globally unique
- Function names are case-sensitive
- UK South region code is "uksouth"
- Default authentication level is "function" which requires a function key