Failed to generate proxies for remote module 'Microsoft.Online.SharePoint.PowerShell'

sithender surapur 21 Reputation points
2022-08-02T14:28:14.723+00:00

Hello Team,

We are trying to run a Powershell script inside Azure Functions with Import-Module. It worked some time but ran after started giving error.

Below is the code to import Module

using namespace System.Net
param($Request, $TriggerMetadata)
Import-Module "$($PSScriptRoot)\Microsoft.Online.SharePoint.PowerShell\08032022\Microsoft.Online.SharePoint.PowerShell.dll" -DisableNameChecking -UseWindowsPowerShell

We also tried adding below line of code.

[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12

Error details:

227275-image.png

any thoughts what was we are doing wrong.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
0 comments No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 70,936 Reputation points Moderator
    2022-08-05T02:51:12.573+00:00

    @sithender surapur Apology for the inconvenience due to this issue. It looks like the known issue where PowerShell SDK version 7.0.11 is used by Azure Functions PowerShell in the latest Functions runtime versions and the tentative fix should be at the end of August.
    Can you please pin the Function App to the previous Functions runtime version 4.6.1.1 (for v4 Apps) or 3.8.2.0 (for v3 Apps) by updating the FUNCTION_EXTENSION_VERSION in the application configuration of your function app if you are running PowerShell function version 7 and confirm if it resolves your issue?

    Feel free to get back to me if you need any assistance.

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.