How to Run Multiple PnP Scripts in an Azure Function App
Question details
The user needs to execute multiple PnP PowerShell functions inside a single Azure Function App.

- Product
- Azure Function App
- Device & OS
- not provided
- Scenario
- Setting up and organizing multiple PnP PowerShell scripts with different triggers under one App Service.
- Observed behavior
- The user must configure separate function directories and a shared host.json file to successfully deploy and manage multiple scripts in one environment.
Ensure you have an active Azure subscription, the Azure Functions Core Tools installed locally, and basic familiarity with PnP PowerShell modules and App Service deployment.
Organize Function Directories and Configure host.json
By creating separate folders for each trigger and utilizing a shared configuration file, you can host multiple functions in a single Azure App Service.
Azure Functions support hosting multiple endpoints or triggers within the same App Service plan. For PnP PowerShell, this means you can consolidate your scripts by isolating each trigger in its own directory while sharing the application-level configurations.
Inside your main Azure Function App directory, create distinct folders for each of your triggers. For example, name them CosmosDBTrigger, TimerTrigger, and HttpTrigger based on their purpose.
Place the respective run.ps1 and function.json files inside each of the newly created trigger directories.
In the root directory of your Function App, create or edit the host.json file to manage the global configuration settings shared across all functions.
Update the requirements.psd1 file located in the root directory to include the PnP PowerShell module, ensuring it is available to all functions within the app.
Deploy the Function App to Azure. Once the deployment finishes, navigate to your App Service in the Azure Portal and check the 'Functions' menu to verify that each script appears correctly.

Need a Lightweight Tool for Your IT Documentation? Try WPS Office
While managing Azure Function Apps and PowerShell scripts, IT professionals often need to document system architectures, export logs to spreadsheets, or prepare technical presentations. WPS Office offers a free, lightweight, and highly compatible alternative to Microsoft Office for all your technical documentation needs.
- 1. Download the software: Visit the official WPS Office website and click the free download button for your operating system.
- 2. Install WPS Office: Run the installer file and follow the quick on-screen instructions to set up the suite on your computer.
- 3. Open and edit files: Launch WPS Office to instantly open, edit, and save your existing Microsoft Office documentation files without formatting loss.

Frequently Asked Questions
Can I use different trigger types in the same Azure Function App?
Yes, you can combine multiple trigger types like HTTP, Timer, and Cosmos DB triggers within the same Function App. You just need to place each trigger in its own separate directory with a dedicated function.json file.
How do I share the PnP PowerShell module across multiple functions?
You can make the PnP PowerShell module available globally to all functions within the app by defining it in the root-level requirements.psd1 file. Azure will automatically download and manage the dependency.
Why are my PowerShell functions not appearing in the Azure portal?
Ensure that your folder structure is correct (each function needs its own folder containing a function.json file) and that the shared host.json file in the root directory is properly formatted. You may need to restart the App Service or redeploy the app.




