我正在尝试从Visual Studio运行我的代码。代码是创建运行空间并连接exchange online来运行poweshell脚本。脚本的初始行是
if (Get-Module -ListAvailable | Where-Object {$_.Name -eq 'ExchangeOnlineManagement'}) {
Write-Host ""Module ExchangeOnlineManagement is not imported, but available on disk. Importing it. ""
Import-Module ExchangeOnlineManagement
}在执行时会出现错误
AuthorizationManager check failed.The 'Connect-ExchangeOnline' command was found in the module 'ExchangeOnlineManagement', but the module could not be loaded. For more information, run 'Import-Module ExchangeOnlineManagement'有没有人能帮忙找出问题所在?
发布于 2020-12-14 21:40:23
解决方案:创建web作业,而不是控制台应用程序。
现在已经解决了。问题出在控制台应用程序上。当我创建一个新的网络求职申请时,同样的代码运行良好。
当您尝试在控制台应用程序中运行此脚本时,会出现此AuthorizationManager check failed PowerShell错误。此错误不是出现在web作业中,并且未成功连接到Exchange online。
https://stackoverflow.com/questions/65025606
复制相似问题