How To Add Custom Modules to Azure Functions App

You can add the custom modules to your Azure Functions App using the FTP. Essentially, we need to configure a service account using the Azure Portal that will have access to the Azure Function App FTP. Now, from the FTP, we can add the Custom modules to the Azure Functions App in the path \Site\wwwroot\[Functionname].

How To Add Custom Modules to Azure Functions App

Another option for using external PowerShell Modules inside your Azure Function App is to utilize Advanced Tools (Kudu) for this purpose. This is one of the best options to use in this case. Let’s follow the steps below.

Add Custom Modules to Azure Functions App using Kudu

Navigate to your Azure Function app that you have created to use with PowerShell. Click on the Advanced Tools link under the Development Tools section.

Import PowerShell Module or Package into your Azure Function App

Now, click on the Go button on the Advanced Tools window.

How To Add Custom Modules In The Azure Functions App

Select the CMD option from the Debug console drop-down in the top navigation window.

Add Custom Modules In The Azure Functions App

Navigate to the subfolder site/wwwroot/{yourFunctionName}. You can see there that two default files run.ps1 and function.json

Click on the Home Button –> Site –> wwroot –> Click on your Function Name

How To Add Custom Modules In The Azure Functions App using Kudu

Now click on the + button –> New Folder and create a folder with the module name like below

Custom Modules In The Azure Functions App
How To Load Custom Modules From The Azure Functions App

Now you can drag and drop the files from your local path to this folder

How To Load Custom Modules From The Azure Functions App using Kudu

Now, copy the complete path from the CMD window and keep it, as we need to add that in our Import statement

How To Load Custom Modules From The Azure Functions App Kudu

For me, the path is D:\home\site\wwwroot\MyHttpPowerShellFunction\azurerm

Now you need to import the PowerShell module in the Run.ps1 file like below

Import-Module “D:\home\site\wwwroot\MyHttpPowerShellFunction\azurerm\AzureRM.AnalysisServices.psd1”

This is one of the best options to Add Custom Modules In The Azure Functions App.

FAQs

How To Load Custom Modules From The Azure Functions App

Once you upload the custom module to the Azure Functions App, import it in the Run section. ps1 file on the Function windows as shown above. The import statement will be like below

Import-Module home\Site\wwwroot\MyHTTPPowerShellFunction\[YourModuleFolderName]\filename.psd1

Wrapping Up

In this article, we discussed how to add custom modules to an Azure Functions App. Thanks for reading this article !!!

You may also like the following articles.

Azure Virtual Machine

DOWNLOAD FREE AZURE VIRTUAL MACHINE PDF

Download our free 25+ page Azure Virtual Machine guide and master cloud deployment today!