RousselTMLEARNING

TP · Microsoft Azure: from discovery to expertise

Lab: A queue-triggered Azure Function, locally

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

An HTTP API that queues orders and a function that turns them into invoices.

Hands-on #

Guided steps, with their solution.

  1. 1. Create the project

    Why? The local.settings.json file points function storage at Azurite.

    Initialise a Python project and check that AzureWebJobsStorage is UseDevelopmentStorage=true.
  2. 2. Write both functions

    Why? The output binding enqueues the message without storage access code; the queue trigger calls the function for each message.

    Replace function_app.py with an HTTP function commande and a queue function facturer that writes a blob.
  3. 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. 4. Handle failures

    Why? A failing message is retried five times then moved to the "-poison" queue: nothing is lost.

    Send an order without a total field, watch the retries then the commandes-poison queue.

Difficulty level : ●●●○○ (3/5)

My progress

  • ⏱ Estimated time : ≈ 1 h

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.

Ask a question about this lesson →

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...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!