Building a Serverless REST API With Azure Functions From Scratch

  Переглядів 28,671

Codewrinkles

Codewrinkles

День тому

Building a serverless REST API with Azure Functions is a good exercise to get familar with all the ins and outs of Azure Functions. In this video we go from depth to depth by implementing complete CRUD operations for a REST API running 100% on Azure Functions. This setup allows us to go deeper into topics like function workers, dependency injection in Azure functions, using EF Core in Azure function, securing secrets via Azure Key Vault and much more. Make sure to not miss it!
Join this channel to get source code access and other perks:
/ @codewrinkles
Content:
1. Intro: 00:00
2. Create Azure Function App: 01:30
3. In process vs islolated Azure Functions: 02:16
4. Finalizing Azure Function App creation: 03:12
5. Azure Functions and Azure Key Vault: 04:09
6. Create Azure Functions Project: 05:06
7. Azure Functions settings: 05:56
8. Installing NuGet packages: 07:50
9. Create Product and DbContext: 09:12
10. Dependency injection in Azure Functions: 10:55
11. Creating API endpoints in Azure Functions: 14:03
12. Azure Functions Authorization Level: 15:16
13. Azure Functions HttpTrigger: 17:31
14. Working with Http requests in Azure Functions: 18:55
15. Implementing remaining endpoints: 21:27
16. Debugging Azure Functions locally: 25:10
17. Deploy Azure Functions: 26:11

КОМЕНТАРІ: 86
@jamesbest2221
@jamesbest2221 Рік тому
This video is fantastic! Pure gold! It finally answers all the (head scratching) pieces that are needed to put together a full serverless api. I also very much appreciate how your videos have no fluff, and are meat-and-potatoes and pedal-to-the-metal all the way, which is great for someone like me who has very limited time and can learn fast. Cheers!
@Codewrinkles
@Codewrinkles Рік тому
Really appreciate your feedback. I'm glad you enjoyed it.
@Tech-wn8tp
@Tech-wn8tp 7 місяців тому
precisely described what i also felt
@seeker4430
@seeker4430 27 днів тому
Fantastic... Underrated content... To the point, clear and covers everything beautifully
@ramfattah211
@ramfattah211 Рік тому
Loving these C# and Azure videos. Looking forward to learning more from you.
@Codewrinkles
@Codewrinkles Рік тому
I'm glad to hear. There will be one Azure video each Sunday or Monday till at least the end of the year.
@vrtualminds-wi7si
@vrtualminds-wi7si 2 місяці тому
The best tutorial regarding Az Functions.
@markharby180
@markharby180 8 місяців тому
This is one of the best tutorials I have found on API Azure Functions, great work.
@Codewrinkles
@Codewrinkles 8 місяців тому
Glad it was helpful!
@Ram92026z
@Ram92026z 8 місяців тому
You are divine! This is so helpful. Thank you.
@Tech-wn8tp
@Tech-wn8tp 7 місяців тому
thank you guru! subscribed you and learned something from you today. you are the best!
@danielegiovanetti9258
@danielegiovanetti9258 Рік тому
I can't find other words to say thank you. You special!
@Codewrinkles
@Codewrinkles Рік тому
Wow, thank you!
@samitkrghosh4388
@samitkrghosh4388 10 місяців тому
This tutorial is really helpfull for those who started carrier as azure developer like me . Thanks a ton....
@FiggyCricket
@FiggyCricket 10 місяців тому
I know that you mentioned doing migrations with EF Core could be difficult. But I wanted to let folks know that scaffolding with EF Core works very easily with Azure Functions. I feel like database first is more typical in production environments so I wanted to point that out.
@avneetsingh2010
@avneetsingh2010 9 місяців тому
Amazing work!
@Codewrinkles
@Codewrinkles 9 місяців тому
Thank you! Cheers!
@user-hy1dm4in6b
@user-hy1dm4in6b 5 місяців тому
Really good video. A good follow-up might be explaining the objects you created beforehand, especially the "sql" secret since the app won't run without that part working. I'm not asking for an in-depth code-first migrations video, but a database first explanation so new people can get this app up and running. Excellent work!
@visheshgrade9861
@visheshgrade9861 3 дні тому
Randomly saw this today, to check my understanding, covered everything in a short video. I generally don't comment, but great work 😀. Now will see more videos here 😅
@Codewrinkles
@Codewrinkles День тому
Glad you enjoyed it!
@sushilb7994
@sushilb7994 7 місяців тому
Great video! I have a question - how to use azure key vault when we specify something in the input binding like service bus queue trigger where queue name and connection string is supposed to be taken from azure key vault. Any help on this would be really appreciated.
@kushagrame
@kushagrame 6 місяців тому
Thank you sir very beautifully explained....
@TaNTaTANify
@TaNTaTANify 3 місяці тому
Great video! thanks! it was very understandable and with a nice pace.
@Codewrinkles
@Codewrinkles 3 місяці тому
Glad you liked it!
@lordmen92
@lordmen92 Рік тому
Thanks for awesome sharing
@Codewrinkles
@Codewrinkles Рік тому
Thanks for watching
@sahoopradipta
@sahoopradipta Місяць тому
Very nice and easy explanation. Thanks..
@sonofvideo4696
@sonofvideo4696 10 місяців тому
Excellent video.
@jacopocaira5199
@jacopocaira5199 8 місяців тому
Hey! Do you have a video that cover the auth topic for the functions? Thanks, Great video!
@juhairahamed5342
@juhairahamed5342 3 місяці тому
Good explanation..thanks
@yusunryu1129
@yusunryu1129 Рік тому
Thank you. I really enjoyed your vide. I think sql setup is missing in this video. How do you setup the azure sql for Functions?
@philipquarles4679
@philipquarles4679 6 місяців тому
Great video! Showing how to do local testing is exactly what I was looking for! I would like to use Dapper instead of Entity Framework. Is that possible?
@user-lw5uh9ir7y
@user-lw5uh9ir7y 3 місяці тому
Nice Work
@samitkrghosh4388
@samitkrghosh4388 10 місяців тому
If you please create some more topics on azure service bus integration with azure function would be very helpful
@pigrebanto
@pigrebanto 5 місяців тому
Thanks. Did you use Azure SQL?
@arvindchourasiya4738
@arvindchourasiya4738 5 місяців тому
Great video, so much to learn here. I just have one doubt, in connection string you did specify vault key only, not db credentials then how it is connected to SQL Server, is the data comes from Azure or SQL ?
@sauravbhatta5303
@sauravbhatta5303 Рік тому
Very good video. Also make a video on service fabric. Deploy the app there as well.
@Codewrinkles
@Codewrinkles Рік тому
Will try. Thank you for the visit.
@saroshwadia
@saroshwadia Рік тому
awesome video as usual - three thumbs up - Could you highlight some pros and cons in terms of speed, cost etc. of using AF vs WebAPI? Thx
@Codewrinkles
@Codewrinkles Рік тому
That's actually a very good question. What I want to point out is that if you need to build an API for an application I wouldn't recommend using Azure Functions for that. It's simply not scalable and the intent of serveless computing is not to replac eyour APIs. I would therefore use Azure Functions for background processing, for simple and standalone web hooks and other cross cutting concerns, to offload your API.
@anonymoos
@anonymoos Рік тому
Excellent video, thank you! I would like to see how you setup the database, and manage it outside of the Azure Functions. Also, you're using Visual Studio here, and not Rider. Is this functionality not supported in Rider?
@Codewrinkles
@Codewrinkles Рік тому
There was nothing to fancy with the database. I had another ASP.NET Core Minimal API proiect where I have registered the DbContext. I have run a migration and then updated the database. Rider also supports these functionalities. I have done all the documentation part of the video on Rider. However, the UI for creating Azure Functions and other small details are different. But, as there were some UI differences and most people from the audience will use Visual Studio, I thought of also using it to keep everythin as clear as possible.
@mouradaissani8957
@mouradaissani8957 Рік тому
thank you about the video , i would recommand to use the other fasion witch is azure function in an isolated worker process
@Codewrinkles
@Codewrinkles Рік тому
Can you also give some arguments for your recommendation. I had some real challenges with isolated workers in real production applications. First of, custom bindings are nod directly supported. Even though possible, it's a real pain. We needed Custom trigger definitions for Azure Service Bus triggers using NServiceBus message handlers. Also, I have experienced some targeting problems when using certain libraries or SDKs, when we needed to create dedicated assemblies for certain classes that were targeting two different dotnet runtimes. I don't recall the exact specifics, but this workaround was suggested in some GH issues by MS folks. Another bad experience I had with isolated workers is that they ran out of memory at a certain point and it took us a lot of troubles to actually find the root cause for why the function simply stopped working. Due to these reasons I admit I have a slight preference for in-process workers.
@irvinwaldman4233
@irvinwaldman4233 Рік тому
Thank you for the video and awesome channel. One recommendation: the background music is a bit distracting. Your voice is fine by itself :)
@Codewrinkles
@Codewrinkles Рік тому
Thanks for the tip!
@Steve3dot1416
@Steve3dot1416 7 місяців тому
20:11 would it be possible to create two separate method for the get and the post by only changing the attribute and use "get" for the first one and "post" for the second one? This way, each method do only one thing.
@dayank.8499
@dayank.8499 8 місяців тому
Please how to fix that ; System.Private.CoreLib: Exception while executing function: ProductsGetAllCreate. Microsoft.Data.SqlClient: Format of the initialization string does not conform to specification starting at index 0.
@mohammedmabtoul3032
@mohammedmabtoul3032 Місяць тому
Great vid thanks but i want consume those api links on my project to get data and post it into my database how can do it ?
@user-uq8gy2go5l
@user-uq8gy2go5l 10 місяців тому
Thank you
@Codewrinkles
@Codewrinkles 10 місяців тому
You're welcome
@rohinirohini532
@rohinirohini532 11 місяців тому
Will you please do a video on Unit testing on serverless rest Api Azure functions
@Codewrinkles
@Codewrinkles 11 місяців тому
I'm not sure unit testing functions themselves would be useful. I'd integration test them.
@PauIyM
@PauIyM 12 днів тому
I keep getting an error when running the application locally and I submit a post request with the name and price. It says Executed “ProductsGetAllCreate” failed. Exception while executing function. Format of the initialization string does not conform to the specification starting at index 0.
@EvandsonDantas
@EvandsonDantas 8 місяців тому
This video is the nicer that i found. But still confuse for me. AWS look like more simple.
@kudanmedia
@kudanmedia 5 місяців тому
Hi, any chance you might have done the video for running migrations in azure sql db? Thanks for this video, it's exactly what I have been looking for. I'm pro Code First Approach and this video is a good start.
@Codewrinkles
@Codewrinkles 5 місяців тому
I haven't done a video on this specific topic. What is the challenge that you have? Running migrations in azure sql (or just updating the database, to be more precise) works exactly the same. You just need to provide the connection string to your Azure SQL database and then run update-database from package manager console. P.S: Thanks for joining the membership program.
@kudanmedia
@kudanmedia 5 місяців тому
@@Codewrinkles Thanks for the fast response. I'm getting this error: Azure.Identity.CredentialUnavailableException: 'DefaultAzureCredential failed to retrieve a token from the included credentials.
@pentanoir
@pentanoir Рік тому
Great video, but EFCore 7 targets .NET6 so there is no reason to choose version 6 when installing the nugget package.
@Codewrinkles
@Codewrinkles Рік тому
That's what I also thought initially. But if you insall EF7 in the exact same setup you will get errors on build that suggest target mismatches because of some other librarbies that both .NET 6 and EF7 relies. Als I have found that this is a common issue and SO is full of issues like this. The answer was pretty much always to use EF 6. If you have more insights into this and cand share how exactly we can make it work running .NET 6 anf EF7, please share it. I'd appreciate it a lot.
@bloopers2967
@bloopers2967 Рік тому
Very good video
@Codewrinkles
@Codewrinkles Рік тому
Thanks for the visit
@bloopers2967
@bloopers2967 Рік тому
@@Codewrinkles Can you please create in-depth video on tweaks related to designTimeFactory as you said in this video. It'll much appreciated as my current project using it and I'm having difficulty understanding it. Thank you in advance!
@bloopers2967
@bloopers2967 Рік тому
I'm waiting for this video sir
@Codewrinkles
@Codewrinkles Рік тому
@@bloopers2967 I am really considering it, but i can't promise a timeline for this. I'll need to define a story around it, but it's definitely on my ToDo list.
@bloopers2967
@bloopers2967 Рік тому
@@Codewrinkles thank you, take your time mate
@nuthanmurari
@nuthanmurari 4 місяці тому
Thank you for your video on this in-process model. If possible can do a video on isolated-model how DI is to be and how to inject or register project reference library in azure functions. I am getting a lot of DI issues similar like this. Exception: System.InvalidOperationException: Unable to resolve service for type 'System.IRequestContext' while attempting to activate 'MyFunctionApp.AntiVirus.FileScanService'. I used IRequestContext in FileScanService and this issue is coming in my azure function when i inject my my IFileScanService. Kindly help me here on how to fix this
@DoorThief
@DoorThief 2 місяці тому
You have to register your service in the setup class so that you can activate the class that needs it (constructor)
@panditjitechtalk314
@panditjitechtalk314 9 місяців тому
How to call Ef core operations in azure timer function ? Any help would be appreciated.
@Codewrinkles
@Codewrinkles 9 місяців тому
You have dependency injection in Azure Functions, so you do it similarly.
@colllm
@colllm 5 місяців тому
Great content... than you. But it's hard to pay attention with the background music 😕
@gorman2283
@gorman2283 9 місяців тому
Is this still current with NuGet installs? I can’t find Azure Identity, Azure Security, Azure Functions Extensions or Microsoft EntityFramework Core
@Codewrinkles
@Codewrinkles 9 місяців тому
Something's odd. This video is not that old.Just a few months back. Nothing was released in the meantime. I just checked and I can still find these packages.
@gorman2283
@gorman2283 9 місяців тому
@@Codewrinkles I figured out what I did wrong. I am currently trying to debug and getting the error message "Microsoft.Azure.WebJobs.Script: Error configuring services in an external startup class. Azure.Security.KeyVault.Secrets: A secret with (name/id) sql was not found in this key vault." I think this is referencing the Startup code but I don't know how to fix it.
@gorman2283
@gorman2283 9 місяців тому
I figured out what I did wrong again. Great video and thanks for responding!!! Subscribed on both my YT accounts!
@saadablat2998
@saadablat2998 Рік тому
la crême de la crême, thank you
@Codewrinkles
@Codewrinkles Рік тому
Glad you enjoyed it. Also take a look to the newest video about workflow orchestration with Azure Durable Functions. MIght be interesting as well.
@ajaychourasia5910
@ajaychourasia5910 9 місяців тому
It is really great tutorial. Do you share source code some where?
@Codewrinkles
@Codewrinkles 9 місяців тому
Ambassador members get the source code after each video. So, to gain access to the source code, you need do become a member. Link in the description.
@handsome_man69
@handsome_man69 6 місяців тому
Handsome man
@infinitezymalny
@infinitezymalny 5 місяців тому
The very importat part is omitted, I mean migration.
@igorr4682
@igorr4682 5 днів тому
Given your heavy accent and rapid speech, I find this video rather challenging to follow, making it less useful for me.
@Codewrinkles
@Codewrinkles 4 дні тому
Wow, that's some very constructive feedback. Thanks
@rubberuk
@rubberuk Рік тому
Excellent video.
@Codewrinkles
@Codewrinkles Рік тому
Glad you liked it!
Stop Putting Your Asp.Net Core Secrets at Risk - Use Azure Key Vault!
16:25
Intro to Azure Functions - What they are and how to create and deploy them
1:10:30
😱СНЯЛ СУПЕР КОТА НА КАМЕРУ⁉
00:37
OMG DEN
Переглядів 1,4 млн
Eurovision Song Contest 2024: First Semi-Final (Live Stream) | Malmö 2024 🇸🇪
2:23:45
5 Steps To A More Effective Job Search
19:01
Dev Mentor Dave
Переглядів 13
⚡️  Functions REST API with NodeJs - Part 1 ⚡️
20:14
Diligent Dev
Переглядів 10 тис.
Build a website using Azure Static Web Apps and Authenticate with AAD
31:27
Quick API Endpoints Using Data API Builder
12:35
Microsoft Developer
Переглядів 8 тис.
Build serverless APIs with Azure Functions | Azure Friday
16:35
Microsoft Azure
Переглядів 30 тис.
Reverse Proxy vs API Gateway vs Load Balancer
3:06
ByteByteGo
Переглядів 89 тис.
Azure Functions for .NET Developers - Everything You Need To Know
1:12:49
Microsoft Azure Developers
Переглядів 4,8 тис.
Result of the portable iPhone electrical machine #hacks
1:01
KevKevKiwi
Переглядів 8 млн
Игровой ноутбук за 100тр в МВИДЕО
0:58
KOLBIN REVIEW
Переглядів 293 тис.
Эволюция телефонов!
0:30
ТРЕНДИ ШОРТС
Переглядів 4,9 млн