Tushar Bandi
Tushar Bandi

Reputation: 5

How to include dependent files in Azure functions

I have a PowerShell script that runs locally that I want to make into an Azure function so it can be called from anywhere. The script imports another script file as well as an AES file for encryption of a password.

How can I include the files and import them in my script? Also, is there a way to import from GitHub instead of including with the project?

I'm very new to Azure, so any help would be great!

Upvotes: 0

Views: 464

Answers (2)

BrettMiller
BrettMiller

Reputation: 1046

The PowerShell developer reference documentation shows you how to include custom modules within your functionApp.

https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-powershell?tabs=portal#custom-modules

At present you are able to utilise the ManagedDependencies within Functions but this does not allow custom repositories for feeds and only the PowerShell Gallery.

If you want to pull this script from Github or another repository then you should look at implementing CI/CD for your function so that your scripts/modules/dependencies are pulled in and deployed alongside your code.

Upvotes: 0

anon
anon

Reputation:

Instead of including the dependent files/packages with the project in Azure Functions, you can use Azure File Shares.

To decouple the dependencies or artifacts from the application code, consider the approach of mounting them into Azure File Shares and you can access them programmatically.

Refer to the GitHub Documentation of bringing the dependencies by mounting a file share to the Azure Functions which provides the code to access the dependencies from the File Share as well how to create and upload them to the Azure File Shares.

Upvotes: 0

Related Questions