Open
Description
Azure CloudShell has been offering for some time now the ability of using Connect-EXOPSSession, without importing any module manually.
However trying to use the Connect-EXOPSSession cmdlet within an Azure Function results in the error below. Is there anything extra required to have this working - along with other Exchange Online cmdlets - or it's simply not supported for now ?
2020-07-29T20:15:03Z [Error] ERROR: The term 'Connect-EXOPSSession' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Exception :
Type : System.Management.Automation.CommandNotFoundException
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : The term 'Connect-EXOPSSession' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
HResult : -2146233087
TargetObject : Connect-EXOPSSession
CategoryInfo : ObjectNotFound: (Connect-EXOPSSession:String) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : CommandNotFoundException
InvocationInfo :
ScriptLineNumber : 12
OffsetInLine : 1
HistoryId : 1
ScriptName : D:\home\site\wwwroot\RetrieveO365PhotosAndInjectToStorage\run.ps1
Line : Connect-EXOPSSession
PositionMessage : At D:\home\site\wwwroot\RetrieveO365PhotosAndInjectToStorage\run.ps1:12 char:1
+ Connect-EXOPSSession
+ ~~~~~~~~~~~~~~~~~~~~
PSScriptRoot : D:\home\site\wwwroot\RetrieveO365PhotosAndInjectToStorage
PSCommandPath : D:\home\site\wwwroot\RetrieveO365PhotosAndInjectToStorage\run.ps1
InvocationName : Connect-EXOPSSession
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, D:\home\site\wwwroot\RetrieveO365PhotosAndInjectToStorage\run.ps1: line 12
CommandName : Connect-EXOPSSession
TargetSite :
Name : LookupCommandInfo
DeclaringType : System.Management.Automation.CommandDiscovery, System.Management.Automation, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
MemberType : Method
Module : System.Management.Automation.dll
StackTrace :
at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)
at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)
at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Message : The term 'Connect-EXOPSSession' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Data : System.Collections.ListDictionaryInternal
Source : System.Management.Automation
HResult : -2146233087
TargetObject : Connect-EXOPSSession
CategoryInfo : ObjectNotFound: (Connect-EXOPSSession:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
InvocationInfo :
ScriptLineNumber : 12
OffsetInLine : 1
HistoryId : 1
ScriptName : D:\home\site\wwwroot\RetrieveO365PhotosAndInjectToStorage\run.ps1
Line : Connect-EXOPSSession
PositionMessage : At D:\home\site\wwwroot\RetrieveO365PhotosAndInjectToStorage\run.ps1:12 char:1
+ Connect-EXOPSSession
+ ~~~~~~~~~~~~~~~~~~~~
PSScriptRoot : D:\home\site\wwwroot\RetrieveO365PhotosAndInjectToStorage
PSCommandPath : D:\home\site\wwwroot\RetrieveO365PhotosAndInjectToStorage\run.ps1
InvocationName : Connect-EXOPSSession
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, D:\home\site\wwwroot\RetrieveO365PhotosAndInjectToStorage\run.ps1: line 12