azure-files-samples icon indicating copy to clipboard operation
azure-files-samples copied to clipboard

Unable to import the AzFilesHybrid module into an Azure Runbook

Open aakashsheth opened this issue 5 years ago • 5 comments

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.

aakashsheth avatar Jun 09 '20 18:06 aakashsheth

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

alozzy avatar Jun 26 '20 00:06 alozzy

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.

alozzy avatar Jun 26 '20 07:06 alozzy

try to copy the filder in this path, C:\Program Files\WindowsPowerShell\Modules

haseebrehan avatar Jan 19 '22 01:01 haseebrehan

What a mess... time to spend more time.

Karr avatar May 05 '22 21:05 Karr

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.

mrtkprc avatar Nov 30 '22 18:11 mrtkprc