如何检测是否Azure的加入,AzureAccount登录失败或取消? [英] How to detect if Azure Add-AzureAccount login fails or is canceled?
本文介绍了如何检测是否Azure的加入,AzureAccount登录失败或取消?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我使用添加-AzureAccount
登录用户Azure中的Azure PowerShell脚本。可是,我怎样检测,如果用户没有完成登录成功,这样我可以中止脚本?
In an Azure PowerShell script I use Add-AzureAccount
to login the user to Azure. But how do I detect if the user didn't finish the login successfully so that I can abort the script?
推荐答案
不是一个真正的PowerShell的专家(和希望,我们会得到更好的答案),但我们不能做类似如下:
Not really a PowerShell expert (and hoping we would get better answers), but can't we do something like the following:
$a = Add-AzureAccount
If ($a)
{
Write-Verbose "User logged in"
}
Else
{
Write-Verbose "User not logged in"
}
这篇关于如何检测是否Azure的加入,AzureAccount登录失败或取消?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文