Deploy Your Python Script as an Azure Function in Just 5 Minutes | Unleash the Power!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone in this video we are going to see how we can create a Azure function and we'll see how we can like quickly create this video function in less than five minutes or so so let's get started okay so these are my two windows vs code Windows uh one is like empty workspace and the other one is the python function that I want to deploy as Azure function so we are not going to go in depth like what this script does so basically like whatever script that you have written how you can transform that script to ratio function is the objective of this video so first of all what you have to do is uh you have to install this plugin first of all let me show you what are plugins are these click on this extension and search here azure so you need to have these three plugins installed or I would say extensions installed Azure account Azure functions Azure resources and yeah that's it you're good to start once these extensions are installed you would see a Azure um icon here you have to click on that this will show you what all subscriptions you have I'm going to use my personal subscription here here you will see Azure function app you have to expand that and you have to create a new one a dialog box will open that will ask you a couple of details the right note asking me for function happening I'll give it the demo zero one Easter is what is uh zero and time stack I'll since my script is written in Python I'll choose python runtime stack and location you can choose whatever location is closest to your demographic location I'll go ahead and choose these years wait for a couple of minutes or so we are almost done okay so this function app is created successfully so now what you have to do you have to click on that function app and here in the workspace section you would see this lightning board so which says like create function so you have to click on this and this will again ask you to enter a couple of details location I'll keep the current directory language could be python have chosen interpreter okay this is the exciting part so you can write Azure function and there are like a couple of you know offerings that are provided by Azure you can create that Azure function as a HTTP um trigger endpoint or you can you know create this function as a crown job or you can you know create some custom logic like if there is something coming in your blob storage you want it quicker um your Azure function so there can be multiple trigger points as well so these are the you know few that you see to your personal Stevie trigger um event creating event Hub excuse storage Service Plus Q Services topic Etc so for this video we'll create a Cron job for Cron job you have to choose time a trigger this is the um the wrong expression while set this to each minute okay we are done it has generated in generated some You Know sample boilerplate code for you in your workspace it has pretty much everything that you need foreign function [Music] but before that here you see a requirement.txt okay so this will be used for dependency management because if there are any other dependencies that you have used in your script so you need to add those here okay so I've just used one X4 Library which is request I'll just add it here and okay let's go to this init dot pi this is the entry point of your application so now this function will be triggered um as per your current expression and now what I'll do I'll copy all my code and paste it here one thing that we can change here is passing this variable and we'll call this method here that's that is all it and let me quickly run this in my local and show you what is going to be the output okay so as you saw whenever you run that application this will uh you know send a message on your Discord like what is the security report from artifact hunt so when we deploy this using a crown job our you know Azure function should do the same every minute okay so we are done editing our code now what we'll do let's see how you can deploy our code so again you have to click this Azure extension here expand your local project there you'll see your functions click on the functions that you have edited and click on this depart choose the correct subscription [Music] and the function app it will confirm you if you want to deploy click apply deployment is completed and we can already see messages popped up let's wait for one minute to see if this message is coming again yep so as you can see this message is popping every every minute as we have set up the crown job so yeah one bonus tip this is the portal dot Azure if you want to see uh you know what our resources that you have deployed so you can check out from portrait itself click on this function app and this is the function app that we deployed using vs code and in this function and you have to click on these functions and here you will see there is one diametrical function if you want to access your files that are there click on this and in the developer section you would see code plus test if we click that this will show you what all files that you have deployed um how is the binding for your application what is the current expression that you have set up everything okay so yeah this is one that I was talking about here you can say let's see the init.pi and function dot Json will show you the binding details and the schedule of your common job and if you want to see Becca overall these you know functions have Trigger or in case of HTTP triggers when this application and when these unit endpoints are getting invoked you have to click this Monitor and here you would see um you know invocation traces and logs as well in my case it has triggered twice there are two success and zero errors is in so yeah that was it about this video um if you like this content hit the like button and subscribe to my channel for uh a regular this type of content thanks everyone have a good day foreign
Info
Channel: Code On Cloud
Views: 34,125
Rating: undefined out of 5
Keywords: Azure Functions, Python script deployment, serverless computing, Azure development, coding tutorial, optimization techniques, deployment tools, testing Azure Functions, scalability, performance optimization, Azure function app, sample project, live hands-on, hands on
Id: OkRI5kto7-E
Channel Id: undefined
Length: 11min 51sec (711 seconds)
Published: Sat May 27 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.