AZURE FUNCTION ⚡ - Integrate with Azure Queue Storage | Getting Started With ASP.NET Core Series
Вставка
- Опубліковано 27 сер 2024
- Hello 🚀 Functions provide serverless compute for Azure. It allows us to focus on the pieces of code that matter most, and Functions handle the rest. Azure Functions can be used to build web APIs, respond to database changes, process streams, manage message queues, and more. With Azure Functions we write less code, have less infrastructure to maintain and in turn, we save on cost.
In this video, let's write our first Azure Function and understand more about how it works and the different core concepts when using them. I will show you how to create your first Azure Function, integrate it with Azure Queue Storage and automatically listen for messages dropped to the queue.
I will also show you how to use Managed Identity to authenticate Azure Function with Azure Queue Storage so that you don't need to set up any Secrets or connection strings in code.
🔗 Getting Started with Azure Functions ⚡www.rahulpnath...
🔗Azure Functions - azure.microsof...
🔗Azure Functions Core Tools - docs.microsoft...
Additional Watching
📹Azure Queue Storage - • AZURE QUEUE STORAGE Fr...
📹Azure Functions DevOps - • AZURE FUNCTION DEVOPS ...
📹Managed Identity - • Azure SDK DefaultAzure...
📹 ASP NET Core Series - bit.ly/asp-net...
Come say hi! ✋
🌍 Blog - rahulpnath.com/
✉ Subscribe to my Newsletter - www.rahulpnath...
🐦Twitter - / rahulpnath
📸Instagram - / rahulpnath
🎥 Recording Setup and Workflow - www.rahulpnath...
Make sure to SUBSCRIBE to the channel. THANK YOU for helping me grow this channel !!
Dear Rahul, your videos are pure gold.
Thank you Finn!
Thank you brother.. Fully understood :)
Great to hear that Praveen!
Very informative...could you please make a series or a single video at least on Azure search services with a demo?
Glad you like it and Thank you Kumar for your suggestion. Will add it to my list.
Learning AF right now, this is the juice. Thank you sir!
Great to hear that Arrak! Also check out how you can use DI in Azure Functions here www.rahulpnath.com/blog/dependency-injection-in-azure-functions/
And you can call me Rahul 🙂
@@RahulNath Wow, you save my time brother. Can't thank you enough. You have such a hight quality videos. Keep it up! Bless you.
@@chaosknight3175 Happy to hear that and glad it helped!
Great content, mate.. pretty good english pronunciation as well. Thanks and congratz!!
Thanks! 😃
Thanks very detailed demo and excellent explanation. Are you planning some demo on Azure Table storage with EF Core?
Thank you and great suggestion! Added to my list.
I can relate your explanation to Scott Hanselman. What a wonderful learning from your channel.
Wow thank you for your kind words Nagesh. Scott's been a huge motivation for me throughout my tech journey!
Amazing Content. Keep up the good work😊
as always Great session Rahul, Its helping me a lot. Specially your azure configuration service with feature management. QQ, Do you have any plan to have a kubernetes session in upcoming videos? Would love to hear your thoughts on docker, ACR, services, ingress and overall K8s. More power to you ! 🙌
Great video. Pace is excellent and major angles are covered.
Glad you liked it Tom!
Highly underated channel... Keep up the good work Rahul
Thank you Rajesh for your kind words! 😀
Hi Rahul, your tutorials are very much informative and very easy to understand. I have a requirement that, I don't want to process all queue items concurrently from azure function. Its like I want to process 10 items batch at a time and after completion want to process another 10 items batch. Is it possible to do with azure function or I need to move in Azure Batch service. Please suggest, and if possible please make a video on azure batch service.
Glad you like the content Manas. Have you looked at concurrency settings in Azure Functions? learn.microsoft.com/en-us/azure/azure-functions/functions-concurrency
Please consider Azure Kubernetes Service tutorial videos too. Like how to architecture ASP NET Core CRUD app with Azure SQL for to be deployed to AKS.
Thank you Finn for your suggestion. I have added it to my list. Not sure when I will get it to it though, most of my current work is around Serverless and haven't used AKS much.
Love your videos! Thank you for the great work sir.
Glad you like them!
Thanks Rahul, you are the amazing. Congrats.
Thanks a ton! Here are my popular series twitter.com/rahulpnath/status/1499626419357630466?s=20
Thanks for very informative session. I would request you to make a video on Azure Logic App. It would help me to understand.
Glad you like it and Thank you Madhuri for the suggestion. I have added it my list, but not sure when I will get to it! 😀
Thanks for explaining easier way
Most welcome Salim 😊Checkout the full Azure series here bit.ly/azure-series
Hi Rahul,
****PLEASE HELP****
Firstly Thank you so much for covering the topic in detail.
Also, I wanted to *understand* that which is the best option to use among the BackgroundService and Azure function for my usecase?
*USECASE:*
*STEP 1:* will send the uploaded CSV file to the message queue by converting it to JSON string.
*STEP 2:* Using the appropriate service(as per your recommendation) to retrieve the message. Each message data is responsible to invite the CSV users based on mandatory CSV columns, add each user to a group and patch/update user properties based on additional/optional CSV columns.
*STEP 3:* Need to MAIL the uploader the CSV File with the status of the users invitation and properties updates.
Currently what I was doing is processing the whole CSV in the HTTP POST method in controller after receiving the uploaded CSV file but with huge no. of users to process the request, it was getting timed-out due to the *230 seconds* limit. :(
PLEASE HELP!!
Hey Vicky, Glad you like the videos.
Couple of things to consider - How do you want to handle errors? Assuming you have 100 user details coming in the CSV file, what if we a set of records in that fail to process? Do you want to retry this again on it's own? Even though the work is coming in as a CSV file (a batch) do you want to process it as a batch?
Depending on this you can split out each record in the CSV file as independent messages and process them individually. Assuming you have to report back to a user on the progress, you will have to do some mapping on which message came from which CSV file.
But if you want to process the CSV as batch in itself, you will need to handle exceptions in processing in those records. I would save the CSV file in a blob store and use the link to the in the message rather than serializing the whole CSV to a message. You will need to keep in mind the max size of messages etc, depending on how big this CSV file can get.
Hope that gives you some ideas. Let me know if you have additional questions
@@RahulNath Bhai Thanks for such descriptive and detail-oriented response. Actually I was thinking the same for passing the complete CSV file but didn't knew that it can be passed via blob store.
Could you share some *reference* , if possible on how that can be achieved like passing files to store and reading it in Azure function/BackgroundService via Message queue?
🧑🏾💻 Another thing which I wanted to get your suggestion on as I asked above as well which is the best option to use among the *_BackgroundService_* and *_Azure function_* for my usecase especially where MAIL functionality would be involved as stated in *STEP 3* ?
✅ In regards to errors and status actually I am creating a list of model object with the status(valid/invalid) and status details that I will be passing further to the exported file in mail.
@@VICKYCHAWLA I don't have a reference for blob store - but what it would look like is upload the file to blob and send the link/reference to it in the message. or you can use Blob Triggers (learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-blob-trigger?tabs=in-process%2Cextensionv5&pivots=programming-language-csharp&WT.mc_id=AZ-MVP-5003875)
I would prefer Azure Function for this over BackgroundService, especially if you want to use Triggers etc. Also you can easily scale up/down the Function if there are more processing required. A lot depends though on your setup, load and frequency of the files. If you are using BackgroundJobs you could still write it to a blob and use almost similar flow.
@@RahulNath Bhai Thanks for writing in and sharing your valuable recommendations. I will look at it and proceed accordingly. Thanks so much!! 😊
Hi Rahul can u pls make a session about .net microservices using azure service bus
I have one on Azure Service Bus - check out the azure playlist bit.ly/azure-series. Does that help you Bharat? Any specific questions you had
Great brother.. sharp and precise..
Thank you 🙂
mate, your channel is awesome
Thanks mate!
Please make videos on Azure durable functions
Thank you Noor for the suggestion - It's on my list!
Thanke Rahul.
You're welcome!
Hi Rahul . one doubt i had after looking in ur previous videos was What is diffeernce between Azure ueue storage and Azure Service bus Queue . and if when to use which one coz they both are Queue and sounds similar. Also my next question is In Service bus queue , we can set the Lock and do some setting , so can you give link or make another video specifying how to set this Lock settings ???
Great question - I plan to do a video on Service Bus soon. Meanwhile you can check here if you haven't already docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-azure-and-service-bus-queues-compared-contrasted?WT.mc_id=AZ-MVP-5003875
Could you please add a series or video on logic app. Your videos are great!!!!
Good suggestion, but not sure how soon. Haven't done much on logic apps yet.!
hi, its a very helpful video but i need to add a Nuget reference into my function. i created Http triggered function through azure portal. how to add this package ?
Can yu pls do a vedio on how to use extensions in azure functions
So using the Configuration in the video did not help to inject it into your function and pass the Options class to your extension? www.rahulpnath.com/blog/dependency-injection-in-azure-functions/#app-settings
Can you please send me a sample code on what problem you are trying to solve? Email details in About page
Thanks
Thank you for the 'Super Thanks' - This is a first time for me getting this 😀 The full Azure series is here bit.ly/azure-series
outstanding 👍
Thanks again Anjan!
Nice video. How to get azure account for practice, they are not giving trial for new account.
Hi rahul, do you know how the request handling pipeline works in azure function?
If you know please share some useful doc/video links :)
What specifically are you looking for Alacrity. The DI video walks through a bit more on the flow www.rahulpnath.com/blog/dependency-injection-in-azure-functions/
Not sure if that helps you.
Hi@@RahulNath , actually i am curious about the working of Azure function. As we know for a .net core application we have a startup.cs file that contains configure method to configure all the Middlewares , but in azure function i didn't find any such methods. So i have desire to know how the Middlewares working in Azure function that's why i asked you..
ua-cam.com/users/playlist?app=desktop&list=PLmmYSbUCWJ4x1GO839azG_BBw8rkh-zOj this documentation explaining about Middlewares in Azure function.
Thanks 💟
Very comprehensive solution, Rahul. Thanks, learnt a lot. I have a question, Is it possible to trigger the exception messages in the poison queue again after fixing the code that's causing the exception? Can they be triggered again automatically by sending them to the queue?
Yes you can replay messages from the dead-letter queue to the main queue. Hope you resolved this?
Thank you sir! Could you do a video with service bus please.
Good suggestion Sunny. Added to the list. And you can call me Rahul 😀
Muy bueno
Thank you Hector!!
Hi, I am working on azure keyvault and want to send notifications on my email when Keyvault secret is about to expire within 3, 7 and 15 days. Plz help me to do this using azure logic app.
I wrote about this a while back here www.rahulpnath.com/blog/expiry-notification-for-azure-key-vault-keys-and-secrets/
You could also look at this learn.microsoft.com/en-us/azure/key-vault/general/event-grid-tutorial?WT.mc_id=AZ-MVP-5003875
Any full course on Azure deops from you.
Not yet! This the full series bit.ly/azure-devops-series
Is it possible when azure function trigger on adding message in a queue after receiving message from queue it won't remove from queue util I want?
If you throw an exception, Functions trigger will not mark is as processed. It will reappear in the queue after the default message timeout. Does that help? Between what use case are you trying to address here?
Rahul your videos are really good but why do you speak like a robot? :P
Haha thank you Swapnil, glad you like the videos. I'm improving on my camera presence, and working on it slowly. My newer videos are less robotic 😝
Nice video. Is there a way to speed up insertion in queue storage..I'm using timer trigger Azure function to store 2lakh test runs from Azure devops organization into Azure storage queue. The function is throwing timeout error and I can see only 32 testruns being stored. so is there a way to speed up insertion of messages in Azure storage queue and also how can we check how many messages are being stored in queue storage as only the first 32 are visible and rest are hidden?
Hey Shweta, What timeout error is it throwing? Did you already come across this in SO stackoverflow.com/questions/22903312/trying-to-batch-addmessage-to-an-azure-queue
@@RahulNath Yes I did. I want the Azure function to finish execution within 10mins ie.to store 2lakh test runs in storage queue.But it is taking an hour to finish execution. Below is my code for storing testRuns in queue:
public bool SaveTestRunsToStorageAccount(IEnumerable> testRuns)
{
Parallel.ForEach(testRuns, testRun =>
{ var testRunStr= JsonCovert.Serialize(testRun);
_queueClient.SendMessageAsync(testRunStr});
return true;
}
Please guide.
How to return million of records from web api .can u make video on it .I told my requirement last time
Returning millions of records is a bad design. You should probably paginate it.
@@chetan9902 can you give any video link for that. I am truely looking for that solution
Maybe this is a good start - code-maze.com/paging-aspnet-core-webapi/
Google should help you here. Based on the type of the database implementations will change. But the general idea is that you page records. You would definitely not be showing 1 million records in a UI so there is no reason to get that back in API. I will try and cover a video some time later on pagination in this channel. Hope that helps you for now.
Sir, azure with redis cache
Sure will do soon!