Creating Azure Runbook Jobs For SharePoint Online Using PnP PowerShell

Introduction

In this article, you will learn how to create an Azure Runbook job on Azure automation for SharePoint online portal, using PnP PowerShell cmdlets.


Steps involved

1. Create an automation account.

2. Import PnP PowerShell references as a module.

3. Add credentials.

4. Create Runbook

5. Add the code.

6. Test/Schedule.

7. View the job results.


In this article, I am not explaining more about the creation of an automation account and adding the credentials. I already explained about that in my previous articles. 


Importing PnP PowerShell Module

  • From the automation account, click Assets -> Click Modules -> Click Browse gallery from the modules section -> Find for "SharePoint PnP PowerShell Online".


  • Click the result. Click Import and click OK on the next pane.


  • Once imported, you can see the imported module under the modules section.


Add SPO Credentials

For automation of the scripts, SharePoint online portal credentials needs to be stored on Azure portal. You can save the credentials in the credentials section under the assets component.


Create Runbook<