我想知道是否可以确定某个服务(以及相应的广告位(Production
或Staging
))是否存在部署。
我发现的所有内容都是调用Get-AzureDeployment -ServiceName xxxservice
,这会在PowerShell中引发错误Get-AzureDeployment : ResourceNotFound: No deployments were found.
。
答案 0 :(得分:4)
尝试-ErrorVariable和-ErrorAction参数
$deployment = Get-AzureDeployment -ServiceName $serviceName -Slot $slot -ErrorVariable a -ErrorAction silentlycontinue
if ($a[0] -ne $null)
{
Write-Output "$(Get-Date –f $timeStampFormat) - No deployment is detected."
}