'Connect-PnPOnline' not recognized as a name of a cmdlet when running from Azure Runbook #4880
Unanswered
DavorSukeri
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Ok, I'm newbie with Azure Runbooks, but didn't think I will face problems this early. :D
So I'm trying to run PnP Powershell script to fetch user profile attributes from EntraID profiles and write them to SharePoint user profiles and schedule it to run weekly.
I have imported PnP PowerShell module (module version 3.1.0, runtime version 7.2.) to the Azure Automation account (and I can see it when browsing the imported modules) and assigned permissions to SharePoint to the Managed Identity like this:
However when I'm testing my script I get this:
Connect-PnPOnline -URL https://xxx.sharepoint.com/ -ManagedIdentity

Then I tried to add Import-Module PnP.PowerShell before the Connect-PnPOnline cmdlet and I get this:

However if run Install-Module -Name PnP.PowerShell before the Connect-PnPOnline cmdlet I don't get those errors, but surely I'm not supposed to install module everytime I run the script.
So two questions:
Beta Was this translation helpful? Give feedback.
All reactions