New-UnifiedGroup要求提供凭据失败

时间:2019-08-28 09:55:38

标签: powershell

我正在我的PowerShell脚本script.ps1

中执行以下命令
New-UnifiedGroup -AccessType Public -Alias <AliasName> -DisplayName <DisplayName>

我已经使用以下命令连接到Azure Active Directory,Microsoft Online和PowerShell Exchange会话($ Credentials具有连接的凭据)

Connect-AzureAD -Credential $Credentials
Connect-MsolService -Credential $Credentials
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Credentials -Authentication Basic -AllowRedirection
Import-PSSession $session -DisableNameChecking -AllowClobber

执行New-UnifiedGroup继续失败,并出现以下错误:

Exception calling "GetSteppablePipeline" with "1" argument(s): "Exception calling "PromptForCredential" with "4" argument(s): "A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: Enter your credentials for https://outlook.office365.com/powershell-liveid/.""
8/28/2019 3:07:10 PM - Stacktrace:
8/28/2019 3:07:10 PM -    at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
8/28/2019 3:07:11 PM - Inner Exception:
8/28/2019 3:07:11 PM - Exception calling "PromptForCredential" with "4" argument(s): "A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: Enter your credentials for https://outlook.office365.com/powershell-liveid/."
8/28/2019 3:07:11 PM - Stacktrace:
8/28/2019 3:07:11 PM -    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
   at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
   at lambda_method(Closure , FunctionContext )
   at System.Management.Automation.Language.Compiler.GetExpressionValue(ExpressionAst expressionAst, Boolean isTrustedInput, ExecutionContext context, SessionStateInternal sessionStateInternal, IDictionary usingValues, Func`2& lambda, IScriptExtent[]& sequencePoints, Type& localsTupleType)
   at System.Management.Automation.PipelineOps.GetSteppablePipeline(PipelineAst pipelineAst, CommandOrigin commandOrigin, ScriptBlock scriptBlock, Object[] args)
   at CallSite.Target(Closure , CallSite , Object , Object )

如果我已经连接,我不确定为什么为什么要再次请求连接凭据。请提出任何指向失败的建议吗?

0 个答案:

没有答案