- 1 year ago 141
PowerShell Question

Determine if Azure Deployments exist for the Specified Service and Slot

I'd like to know if it is possible to determine if a deployment is present for a given service (and the respective slot (


All I found would be to call
Get-AzureDeployment -ServiceName xxxservice
which would throw an error saying
Get-AzureDeployment : ResourceNotFound: No deployments were found.
in PowerShell.

Answer Source

try -ErrorVariable and -ErrorAction parameters

$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."
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download