Create List On SharePoint From Azure Runbook Using PnP PowerShell


In this article, you will see, how we can automate SharePoint list creation mechanism, using Azure Runbook jobs with PnP PowerShell.

Steps Involved

Creating Azure Automation Account.Importing PnP PowerShell references as module.Adding credentials.Create Runbook with the code.Test/Schedule.View the job results.

Note- Creation of an automation account, importing modules, adding credentials are explained in the links of articles, given below-

Here, I will explain more about implementing the logic to create a list. 

The snapshot, given below, shows the credentials added to the Azure automation portal.

The snapshot, given below, shows the required PnP PowerShell module imported to the gallery.

Create Runbook and Schedule

  • First, we will create a Runbook, using PowerShell Workflow type. PowerShell Workflow type is used to implement the complex logic. The inputs can be passed through the parameters, using PowerShell Workflow type.

  • Once created, we can view the script editor of Runbook.

  • For creating a list, we need the necessary input parameters set. The required input parameters can be-

a. Stored Credentials name.

b. Target SharePoint Site URL. 

c. List Name.

d. List Template Name.