Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>So, after investigation, my initial supposition was partly wrong: calls to the new Powershell cmdlets <em>do</em> wait for successful completion, <em>except</em> for <code>Set-AzureDeployment -newStatus "Running"</code>.</p> <p>This is good, as we no longer need to have calls to <code>Get-OperationStatus</code> scattered through the script; it's bad, though, as <code>Set-AzureDeployment</code> leaves the deployment spinning up.</p> <p>We can call <code>Get-AzureDeployment</code>, though, and iterate through the <code>RoleInstanceList</code> to figure out what's going on. Like so:</p> <pre><code>function Get-StagingReady { $stagingStatus = Get-AzureDeployment $azureService -slot staging if (-not $($stagingStatus.Status -eq "Running")) { Write-Host $(" ... ... Staging slot status is not Running; value is " + $stagingStatus.Running) return $False } if (-not $stagingStatus.RoleInstanceList) { Write-Host " ... ... Staging slot has no instances configured yet." return $False } $notReady = $False Foreach ($roleInstance in $stagingStatus.RoleInstanceList) { if (-not $($roleInstance.InstanceStatus -eq "ReadyRole")) { Write-Host $(" ... ... ... Staging slot instance " + $roleInstance.InstanceName + " has status " + $roleInstance.InstanceStatus) $notReady = $True } } if ($notReady) { Write-Host " ... ... One or more instances not running." return $False } Write-Host " ... Staging slot ready for use." return $True } function Wait-ForStagingToBeReady { while ( -not $(Get-StagingReady) ) { Write-Host " ... ... Staging slot not ready, waiting 15 seconds for Azure to spin up instances." Start-Sleep -s 15 } } function Start-Staging { Write-Host " ... Starting staging slot." $staging = Get-Staging $azureService $result = Set-AzureDeployment ` -Status ` -serviceName $azureService ` -slot "Staging" ` -newStatus "Running" if (-not $?) { Write-Host Write-Host "Unable to start staging slot." Write-Host "DEPLOY FAILED" Write-Host exit 1 } Wait-ForStagingToBeReady Write-Host " ... Deployment in Staging slot started." } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload