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.

I believe this error is not due to PowerShell Code issue.
It is an environment setting variable (
PSModulePath) has to be checked.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.
For the tracking of this issue, refer to the MSFT Q&A 920865.