I have an Azure function app that runs some Powershell and as part of it I am importing a custom Powershell module I wrote. I had tested it and it worked, but when I went to test it again it no longer imports the module correctly, it instead gives the following error and I cannot determine why. Because the Powershell on the Azure function is Powershell Core 7.2 and my module requires Windows Powershell 5.1 (its accessing funtions from the AzureAD Powershell module to update a users password and assign a license to that user) I am calling the Import-Module with the -UseWindowsPowershell parameter to enable compatibility.
I've tried several solutions but none of them seem to address the problem, so any help would be greatly appreciated.
ERROR: Failed to generate proxies for remote module 'AzureCon'. The -OutputModule parameter does not resolve to a path, and a user module path cannot be found for the provided name.
CodePudding user response:
I believe this error is not due to PowerShell Code issue.
It is an environment setting variable (PSModulePath
) has to be checked.
($env:PSModulePath).split(";")
It was an issue with
PSModulePath
. Something put inWindows\System32\WindowsPowerShell\Modules
into thePSModulePath
. I'm guessing when 7 tried to load utility it loaded 5.1 utility instead and blew up. Fun troubleshooting though. Now need to find root cause.
Refer to the Import-Module: Failed to generate proxies for remote module
CodePudding user response:
Did you resolve this? I have the same issue.