[BUG] Importing pnp.powershell module in Azure Automation #3047
Replies: 7 comments
-
PnP PowerShell 2.x has dropped support for PS 5.1 , can you please use PS 7.2 in Azure automation and check and let us know ?? |
Beta Was this translation helpful? Give feedback.
-
I have the same issue on my windows 11 box - I got it when I upgraded to powershell 7.2. now I get the error: `PS C:\Users\timw> import-module PnP.PowerShell
|
Beta Was this translation helpful? Give feedback.
-
@devwheel - I've answered you there: #3009 You get this error because you're using the new module |
Beta Was this translation helpful? Give feedback.
-
Hello, I have the same issue. https://learn.microsoft.com/en-us/azure/automation/automation-webhooks?tabs=portal#create-a-webhook Is there a workaround? Thanks |
Beta Was this translation helpful? Give feedback.
-
@Pietro1982 - If you can't use PS7, then do not update the module to |
Beta Was this translation helpful? Give feedback.
-
Can't import PnP.Powershell 2.1.x module in Azure Automation for Powershell Runtime 7.1 (preview) Error importing the module PnP.PowerShell. Import failed with the following error: Orchestrator.Shared.AsyncModuleImport.ModuleImportException: An error occurred when trying to import the module to an internal PowerShell session. Either the module dependencies are not imported correctly or the module is unsupported. Internal Error Message: Import-Module: Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. . at Orchestrator.Activities.SetModuleVersion.GetPs7ModuleVersion(String moduleName, String moduleFullPath, Guid accountId, Guid moduleVersionId, InitialSessionState defaultSessionState) at Orchestrator.Activities.SetModuleVersion.InsertModuleVersion(String moduleName, ModuleLanguage moduleLanguage, String pythonModuleVersion, String moduleFullyQualifiedName, ActivitiesMetadataWorkflowExtension activitiesMetadataWorkflowExtension, Guid accountId, Guid moduleVersionId, Int64 moduleContentByteSize, ContentUriInfo contentUri, String storageUri, Int32 moduleVersion) at Orchestrator.Activities.SetModuleVersion.ExecuteInternal(CodeActivityContext context, String moduleName, ModuleLanguage moduleLanguage, String pythonModuleVersion, String modulePath, Guid accountId, Guid moduleVersionId, Int64 moduleContentByteSize, String storageUri, Int32 moduleVersion) at Orchestrator.Activities.SetModuleVersion.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation) |
Beta Was this translation helpful? Give feedback.
-
For anyone finding this post. My current workaround for PS5.1 was downloading the pnp .nupkg file for version 1.12, then changing the extension to .zip instead and uploading/importing the file manually on Azure. VERY IMPORTANTLY you have to make sure that the name is set to "PnP.PowerShell" otherwise it will fail. Hope it helps! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Reporting an Issue or Missing Feature
When I try to Import the Module 2.1.1 or 2.1.11 nightly version to Azure Automation it always fails, i've tried it with different resource groups and it failed all the times.
Actual behavior
The following message shows up: "Importing of newer version failed."
This is the error which is showed:
Error importing the module PnP.PowerShell. Import failed with the following error: Orchestrator.Shared.AsyncModuleImport.ModuleImportException: While importing the module, an error occurred while processing the module content. Internal error message: Could not load file or assembly 'System.Management.Automation, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. at Orchestrator.Activities.SetModuleVersion.ExecuteInternal(CodeActivityContext context, String moduleName, ModuleLanguage moduleLanguage, String pythonModuleVersion, String modulePath, Guid accountId, Guid moduleVersionId, Int64 moduleContentByteSize, String storageUri, Int32 moduleVersion) at Orchestrator.Activities.SetModuleVersion.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
What is the version of the Cmdlet module you are running?
The import of version 1.12.0 is working fine, but 2.1.1 and 2.1.11 nightly both failed.
Which operating system/environment are you running PnP PowerShell on?
Beta Was this translation helpful? Give feedback.
All reactions