After the development of a single Azure Function or a group of function, we need to deploy it to Azure. That’s the purpose of developing it right? Jokes apart! There are a lot of ways in which we can carry out the deployment in Azure. In this blog, I will help you out with some Tips and Tricks which will help you to deploy Azure Functions using various ways. Let’s look at some of them below.
Various Way to Deploy Azure Functions
-
Using Visual Studio
-
Using Visual Studio Code
-
Deploying using Zip from PowerShell
-
Running using Zip from Blob Storage
Using Visual Studio
Almost everyone who codes an Azure function must be using Visual Studio or Visual Studio code. If you are using Visual Studio the deployment is just a few clicks away. Right click on your project and click publish. A popup will be shown in which you can choose to create a new one or select an existing one.
That’s it, choose your option and click Publish to push your Azure Function to cloud.
Visual Studio Code
If you are a lightweight user who prefers Visual Studio code over Visual Studio, you can still deploy your Azure Functions using it. All you need is the VS Code Extension for Azure Functions and you are good to go. Open VS Code and navigate to Extensions and search for Azure Functions and install the below extension.
After installing the extension you will get the sidebar with the Azure logo and you should be able to sign in to your account. To verify that the extension is installed properly, open a terminal and type func and you should see the below output in the terminal.
Now that you have successfully installed the extension I suppose you might already have a function which is ready to be deployed. Hit Ctrl+Shift+P to deploy the function into an app service in Azure.
For more info refer official documentation.
Deploying using Zip from PowerShell
If you have the zip file for the azure function and if you want another way of publishing instead of the above method, you can very well deploy the zip in very minimal code using PowerShell. The below code will deploy your functions in the selected function app.
Running using Zip from Blob Storage
It’s very easy to run the functions from a zip which can be uploaded to a blob storage of your choice. Using MSBuild create the zip for your function app and upload it to blob storage. Now head back to the Azure portal -> Function App -> Application Settings -> and add a new setting called WEBSITE_RUN_FROM_PACKAGE and paste the URL of the zip.
Stay tuned to TechMeet360 for more blogs and events.