Unable to import the AzFilesHybrid module into an Azure Runbook
Error importing the module AzFilesHybrid. Import failed with the following error: Orchestrator.Shared.AsyncModuleImport.ModuleImportException: An error occurred during module validation. When importing the module to an internal PowerShell session, it was not able to be loaded by PowerShell. There is likely an issue with the contents of the module that results in PowerShell's not being able to load it. Please verify that the module imports successfully in a local PowerShell session, correct any issues, and then try importing again.
I am also unable to import the AzFilesHybrid module, but the error message is different:
PS C:\temp\AzFilesHybrid> Import-Module -Name AzFilesHybrid -Force
Import-Module : The specified module ‘Az.Network’ was not loaded because no valid module file was found in any module directory.
At C:\Program Files\WindowsPowerShell\Modules\AzFilesHybrid\0.2.0.0\AzFilesHybrid.psm1:947 char:5
+ Import-Module -Name Az.Network -Global -ErrorAction Stop
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (Az.Network:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
Import-Module : The module to process ‘AzFilesHybrid.psm1’, listed in field ‘ModuleToProcess/RootModule’ of module manifest ‘C:\Program
Files\WindowsPowerShell\Modules\AzFilesHybrid\0.2.0.0\AzFilesHybrid.psd1’ was not processed because no valid module was found in any module directory.
At line:1 char:1
+ Import-Module -Name AzFilesHybrid -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (AzFilesHybrid:String) [Import-Module], PSInvalidOperationException
+ FullyQualifiedErrorId : Modules_ModuleFileNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
It still fails, despite running:
Install-Module -Name Az -AllowClobber -Scope CurrentUser
As a followup to my last comment, I was able to resolve the issue by installing PowerShell 7.0.2 and running the v0.2.0 version of the "azure-files-samples" script under that version of PoSH.
The release notes for v0.2.0 should mention the minimum version of Powershell needed.
try to copy the filder in this path, C:\Program Files\WindowsPowerShell\Modules
What a mess... time to spend more time.
You can install AzFilesHybrid from related repostitory: https://github.com/Azure-Samples/azure-files-samples/releases. After download the .zip file, you can call CopyToPSPath script file.