I tried to use powershell script and C# code: using (var ps = PowerShell.Create()) { ps.AddScript(scriptText); ps.AddParameters(strArray); var result = ps.Invoke(); }
Running Powershell script using script file and cmd runner gives the same result. The problem part of powershell script is in:$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection; Import-PSSession $Session; We get the problem, logged in WebJob Run Details: New-PSSession : [outlook.office365.com] Connecting to remote server outlook.office365.com failed with the following error message : WS-Management cannot process the request. The operation failed because of an HTTP error. The HTTP error (50) is: The request is not supported. . For more information, see the about_Remote_Troubleshooting Help topic.+ $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri ht ...+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:Re moteRunspace) [New-PSSession], PSRemotingTransportException+ FullyQualifiedErrorId : WinRMOperationAborted,PSSessionOpenFailed Import-PSSession : Cannot validate argument on parameter 'Session'. The argument is null. Supply a non-null argument and try the command again. Local run works perfect, but I need the application to be hosted in azure. How can I solve this issue?
↧
Can not connect remotely to Exchange online server from azurewebsites and webjobs using powershell command New-PSSession
↧