Jon Rumsey
An online markdown blog and knowledge repository.
Project maintained by nojronatron
Hosted on GitHub Pages — Theme by mattgraham
About Azure Functions
This document was created to store learnings about Azure Functions.
DotNET Conf 2024 Azure Functions in DotNET 9
Presenters:
- Safia Abdalla
- Matthew Henderson
Events handled by code.
Benefits of Azure Functions:
- Only write the code that is absolutely necessary.
- Stick with business logic.
- Not much configuration setup necessary.
Demo:
- Start with an Aspire Solution.
- .NET Aspire provides templates and packages to help build and deploy observable, production ready, cloud-based apps.
- Functions Project: Select "HTTP Trigger" project property.
- Scaffold-out an HTTP Function.
- Add necessary references such as 'Aspire Azure Storage Blobs'.
- Inject Aspire Service Defaults and any other packages like AzureStorage into the Functions Project DI (see Aspire setup and use instructions for details).
- Remember to include
WithReference('refname')
to get Aspire Registration completed.
CSharp DevKit:
- Supports building and debugging Azure Functions in VS Code!
- Use 'Request.http' file to test WRRCs.
- Local debugging functionality across triggers and WRRC!
Benefits of Aspire:
- Structured Logs: View Invocation IDs to find WRRC pipeline events.
- Drill-down into events to get more information on success, errors, and time to process.
Build and Deploy to Azure:
- Certain triggers might have dependencies in order to execute or perform their roles.
- Adding Roles: Use BICEP, or the AZD/Azure Portal to set them, or use Aspire to register the Azure Function Project.
- Pass-in custom Azure service Resource(s) in DI using Builder.
- Configure other infrastructure role(s) in DI using Builder.
- Once configured, use
azd up
to publish to Azure.
- Azure Aspire Dashboard gets deployed into Azure too!
aka.ms/aspire-functions-
Azure Friday: Develop Azure Functions Using V2 For Python
Host: Scott Hanselman
Presenter: Gavin Aguiar
Presenter: Shreya Batra
Overview
Azure Functions:
- Event-driven Service
- Monitoring built-in!
Common Azure Function Use-Cases:
- Automation of Scheduled Tasks (supports Chron Jobs)
- DB Cleansing
- Data Deduplication
- Real-time Stream Processing
Features of V2 Model
Fewer files, more intuitive Python development experience with Decorators, etc.
Integrated programming model:
- Triggers
- Input Binding: Additional data to use within the function
- Output Binding: Data to inject AFTER the function runs
- Simplified File System Model: One File captures all functions
- Templated Code within VS Code
Bindings are like Params and Return values, but for Cloud-based Functions.
Note: Other languages are available like JavaScript, C#, and more!
Demo and Example Notes
How to create a function using V2 Programming Model?
- VS Code with a new project folder.
- Open Command Pallette => Create Function
- Select Python (New Programming Model) (this creates a Virtualized Python Dev environment)
- Review
getting_started.md
- Code is generated as a sample that the developer can edit and take forward.
- Open a Terminal and run
func host start
Functions can also be created "on the fly" instead of with the Command Palette.
- Follow Intellisense advice to drive development.
Note: AzureWebJobsStorage configuration item must be set properly for Storage Emulator service to work locally.
Gavin's second demo showed what amounts to a minimal API with CRUD capability using decorated Python code pushed to Azure Functions.
Decorators Add The Magic
Azure Functions are just plain Python functions, but the Decorators in Python tell Azure the Function should be run in the Azure Functions service!
References
Azure Functions V2 Python Programming Model
Azure Functions Python Developer Guide
Quickstart: Create JavaScript function in Azure using VS Code
Return to ContEd Index
Return to Root README