How to add directories to your function from portal?

Shubham Saini 40 Reputation points
2024-01-07T14:40:22.98+00:00

I created a new function with Linux OS so Azure gave me a warning that files cannot be uploaded for Linux plan. So I went to the storage account > file share > my function share > browse > navigated to the place where code files were present. I uploaded my package.json and package-lock.json and I could see them in my code editor. The problem came while uploading node_modules because the upload functionality only takes in files, not the directories. How do I upload my node_modules to the function from the portal?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
{count} votes

2 answers

Sort by: Most helpful
  1. Azar 31,610 Reputation points MVP Volunteer Moderator
    2024-01-07T17:29:49.4666667+00:00

    Hi Shubham Saini

    You can do this by various ways, let me give you a way use Azure Functions Core Tools (Command Line)

    1. Install Azure Functions Core Tools:
      • Install the Azure Functions Core Tools on your local machine. You can download them from here.
    2. Package Locally:
      • Package your function locally, including the node_modules folder.
       bashCopy code
       func azure functionapp publish <YourFunctionAppName> --no-build
       
    

    Replace <YourFunctionAppName> with the actual name of your function app.

    If this helps, kindly accept the answer thanks much.

    1 person found this answer helpful.

  2. MuthuKumaranMurugaachari-MSFT 22,446 Reputation points Moderator
    2024-01-09T19:59:13.0466667+00:00

    Shubham Saini Thanks for posting your question in Microsoft Q&A. Based on the description above, it seems like you are developing Azure Function in the portal and would like to add package.json and dependent modules in the portal itself. Correct?

    There are lot of Development limitations in the Azure portal as listed and other limitation on Linux Consumption plan is not possible to get into command line mode. With Dedicated or Premium plan, you can SSH into console mode and run npm command to install the modules referenced in package.json.

    https://learn.microsoft.com/en-us/azure/azure-functions/functions-how-to-use-azure-function-app-settings?tabs=portal#platform-features

    User's image

    You can add directory in the File Share with Add Directory option in the portal and then add the needed files but not sure if this would help in your scenario. I am assuming you just want to do it for quick development/testing purposes.

    User's image

    I hope this helps and let us know if any questions.

    -- If you found the answer to your question helpful, please take a moment to mark it as Yes for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.