Hi,
Same issue with Azure Functions.
If you downgrade the version of the ExchangeOnline Powershell module (3.4 or 3.5), it will work again ;)
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have setup an Azure Automation account and loaded the EXO 3.5.1 module along with PackageManagement V1.4.8.1 and PowerShellGet v2.2.5. I open a new PowerShell runbook and just posted a Connect-ExchangeOnline -ManagedIdentity - Organisation "xyz.onmicrosoft.com" command. Saved and tested and got an error
System.Management.Automation.RuntimeException: Unable to find type [Microsoft.Exchange.Management.RestApiClient.ExchangeEnvironment].
at System.Management.Automation.TypeOps.ResolveTypeName(ITypeName typeName, IScriptExtent errorPos)
at System.Management.Automation.Language.Compiler.GetAttribute(TypeConstraintAst typeConstraintAst)
at System.Management.Automation.Language.TypeConstraintAst.GetAttribute()
at System.Management.Automation.Language.Compiler.GetRuntimeDefinedParameter(ParameterAst parameterAst, Boolean& customParameterSet, Boolean& usesCmdletBinding)
at System.Management.Automation.Language.Compiler.GetParameterMetaData(ReadOnlyCollection`1 parameters, Boolean automaticPositions, Boolean& usesCmdletBinding)
at System.Management.Automation.Language.FunctionDefinitionAst.System.Management.Automation.Language.IParameterMetadataProvider.GetParameterMetadata(Boolean automaticPositions, Boolean& usesCmdletBinding)
at System.Management.Automation.CompiledScriptBlockData.InitializeMetadata()
at System.Management.Automation.CompiledScriptBlockData.Compile(Boolean optimized)
at System.Management.Automation.ScriptBlock.Compile(Boolean optimized)
at System.Management.Automation.PSScriptCmdlet..ctor(ScriptBlock scriptBlock, Boolean useNewScope, Boolean fromScriptFile, ExecutionContext context)
at System.Management.Automation.CommandProcessor.Init(IScriptCommandInfo scriptCommandInfo)
at System.Management.Automation.CommandProcessor..ctor(IScriptCommandInfo scriptCommandInfo, ExecutionContext context, Boolean useLocalScope, Boolean fromScriptFile, SessionStateInternal sessionState)
at System.Management.Automation.CommandDiscovery.GetScriptAsCmdletProcessor(IScriptCommandInfo scriptCommandInfo, ExecutionContext context, Boolean useNewScope, Boolean fromScriptFile, SessionStateInternal sessionState)
at System.Management.Automation.CommandDiscovery.CreateCommandProcessorForScript(FunctionInfo functionInfo, ExecutionContext context, Boolean useNewScope, SessionStateInternal sessionState)
at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(CommandInfo commandInfo, CommandOrigin commandOrigin, Nullable`1 useLocalScope, SessionStateInternal sessionState)
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)
The Automation account managed identity was given the necessary permissions to connect to the Exchange Online PowerShell and the Exchange Administrator role following https://learn.microsoft.com/en-au/powershell/exchange/connect-exo-powershell-managed-identity?view=exchange-ps&WT.mc_id=M365-MVP-9501
Have repeated the exercise with a brand new RG, AA and RB with same result
I notice that other users have been reporting the same issue in the last few days on Reddit
Hi,
Same issue with Azure Functions.
If you downgrade the version of the ExchangeOnline Powershell module (3.4 or 3.5), it will work again ;)