Getting method not found exception in azure runbook

Dattatraya Kamthe, Anita 60 Reputation points
2024-09-04T12:47:24.1566667+00:00

I have PowerShell script written in azure runbook. I have installed PnP PowerShell module version 1.12.0 in Azure automation account. I am using some PnP PowerShell commands to access SharePoint resources. I am getting below error while accessing SharePoint page-

Method not found: 'System.ReadOnlySpan`1

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,366 questions
Microsoft 365 and Office SharePoint For business Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Amira Bedhiafi 33,071 Reputation points Volunteer Moderator
    2025-06-10T07:03:11.2066667+00:00

    Hello Anita !

    Thank you for posting on Microsoft Learn.

    PnP PowerShell (especially from v1.x onward) targets .NET 5+ / .NET Standard 2.0+ and may not be fully compatible with the .NET Framework 4.7.2 runtime used in Azure Automation Classic Runbooks (which PowerShell 5.1 runbooks still rely on).

    I think the version 0.3.1 is the last stable version and compatible with Azure Automation runbooks.

    Or, you need to switch to Hybrid Runbook Worker.

    https://learn.microsoft.com/en-us/azure/automation/automation-hybrid-runbook-worker

    0 comments No comments

Your answer

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