1

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.

this is an image of the problem occurring

1 Answers1

0

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 in Windows\System32\WindowsPowerShell\Modules into the PSModulePath. 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

Update:

Similar ticket raised in MSFT Q&A and it is identified as a new function runtime release broke this functionality.

Thanks to @MayankBargali for the workaround given to fix this issue.

Apology for the inconvenience due to this issue. The workaround is to update the runtime version to 3.8.2.0 by updating the FUNCTION_EXTENSION_VERSION in tha application configuration of your function app if you are running PowerShell function version 7.
The product team will be fixing the issue in the latest runtime.

For the tracking of this issue, refer to the MSFT Q&A 920865.