This solution contains two different Azure Function projects, one triggered by an Azure Storage Queue, the other by an HTTP request (think API).
In the Storage Queue project, I've also demonstrated setting up dependency injection and injecting custom options for use in services.
Checkout a full walkthrough of the solution on Youtube.
The solution should run basically as-is. Note that you will need to install the Azure SDK or use the standalone installer to get the Azure Storage Emulator on your machine (also note that this emulator is being replaced, but that the new emulator doesn't fully work as-is yet).
The notes on getting the emulator working are here:
https://docs.microsoft.com/en-us/azure/storage/common/storage-use-emulator
Alternatively, you can specify real connection strings in local.settings.json
and appsettings.json
to use a real Azure Storage instance.
To run the Queue triggered function locally, set your IDE to run both the queue triggered function project and the included console app project (with or without debugging), then press enter in the console window once it's running.
To run the Queue triggered function on Azure, make sure the storage queue has been created, then add a queue message manually in the Azure portal.
To run the HTTP triggered function, I recommend using a tool like Postman to create a simple POST request to the URL indicated when the debug window loads locally or from the Azure Function settings on Azure after publishing.
My many, many thanks to IAmTimCorey on YouTube (and he also has some FANTASTIC courses) for his overviews/demos of Azure Functions and Azure DevOps CI/CD. Both were HUGELY helpful getting me started.
Big thanks to Layla of LaylaCodesIt for inspiring me to give Functions a whirl to begin with. 😁
Thanks, too, to Microsoft for the great docs on adding DI to functions.