确定指定的服务和插槽是否存在Azure部署

时间:2013-12-27 02:03:13

标签: powershell azure azure-powershell

我想知道是否可以确定某个服务(以及相应的广告位(ProductionStaging))是否存在部署。

我发现的所有内容都是调用Get-AzureDeployment -ServiceName xxxservice,这会在PowerShell中引发错误Get-AzureDeployment : ResourceNotFound: No deployments were found.

1 个答案:

答案 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."
}