What you will learn in this TP
- Create an Azure Functions project (Python v2 model)
- Use output bindings and queue triggers
- Run and observe functions locally
Introduction #
What you will learn in this section
- Create an Azure Functions project (Python v2 model)
- Use output bindings and queue triggers
- Run and observe functions locally
Context. The billing service must process each order without blocking the API. You build asynchronous processing with Azure Functions, running on your machine.
Prerequisites: Docker, Azure CLI, Azure Functions Core Tools and Python 3; the Azurite emulator (docker run mcr.microsoft.com/azure-storage/azurite) replaces Azure storage: no subscription required · Estimated time: 60 min
Hands-on #
Guided steps, with their solution.
1. Create the project
Why? The local.settings.json file points function storage at Azurite.
Initialise a Python project and check thatAzureWebJobsStorageisUseDevelopmentStorage=true.2. Write both functions
Why? The output binding enqueues the message without storage access code; the queue trigger calls the function for each message.
Replacefunction_app.pywith an HTTP functioncommandeand a queue functionfacturerthat writes a blob.3. Run and test
Why? The local Functions runtime is the same as in Azure.
Start the functions, send an order, watch the logs and check the invoice in the container.4. Handle failures
Why? A failing message is retried five times then moved to the "-poison" queue: nothing is lost.
Send an order without atotalfield, watch the retries then thecommandes-poisonqueue.
Difficulty level : ●●●○○ (3/5)
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
Compute on Azure: virtual machines, App Service, Functions and containers
Choose and use Azure compute: virtual machines and scale sets (VMSS), App Service, Azure Function...
Azure storage: storage accounts, Blob, Files, disks and redundancy
Store data on Azure: storage accounts, Blob (hot, cool, archive tiers, lifecycle), Files, Queue a...
Infrastructure as Code on Azure: Bicep, Terraform, Cost Management and Well-Architected
Describe and deploy Azure as code with Bicep (modules, parameters, what-if, pipeline deployments)...
Preparing for the Azure Administrator Associate certification (AZ-104)
Preparation guide for the AZ-104: format, the five domains (identities and governance, storage, c...
Microsoft Entra ID, RBAC and Azure Policy: identities, permissions and governance
Manage identities and access on Azure: Microsoft Entra ID (users, groups, MFA, conditional access...
Azure networking: VNet, NSG, peering, load balancing and hybrid connectivity
Design networking on Azure: virtual networks and subnets, network security groups (NSG), peering ...
Databases on Azure: Azure SQL, Cosmos DB, PostgreSQL and cache
Choose a managed database on Azure: Azure SQL Database and Managed Instance, Azure Database for P...
Monitoring and protecting Azure: Monitor, Log Analytics, Defender, Key Vault and Backup
Operate Azure: Azure Monitor (metrics, activity logs, alerts), Log Analytics and KQL, Application...
Preparing for the Microsoft Azure Fundamentals certification (AZ-900)
Preparation guide for the AZ-900: format, the three domains and their weightings, notions to mast...