2
votes

I'm using the Windows Azure PowerShell Cmdlets v0.6.7 from here: https://www.windowsazure.com/en-us/manage/downloads/

When I run the following command:

Move-AzureDeployment -ServiceName $AzureServiceName

I get the following error:

Move-AzureDeployment : There was no endpoint listening at https://management.core.windows.net/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/services/hostedservices/xxxxxxxxxxxxxxx/deploymentslots/Production that could accept the message.

The error is somewhat correct, there is only a deployment in my Staging slot. However, the documentation for Move-AzureDeployment (http://msdn.microsoft.com/en-us/library/windowsazure/jj152834.aspx) states:

If there is a deployment in the staging environment and no deployment in the production environment, the deployment will move to production.

The preceding Azure PowerShell Cmdlets in the same script, such as New-AzureDeployment, execute successfully. I start the script by using Set-AzureSubscription to configure the subscription info and certificate.

Not sure what I'm missing, any help is appreciated, thanks!

3

3 Answers

2
votes

I ran into this issue as well and resorted to using the REST API for swapping. Here is a sample in case anyone is interested.

    $webRequest = [System.Net.WebRequest]::Create("https://management.core.windows.net/$global:SubscriptionId/services/hostedservices/$serviceName")

    $webRequestContent = ("<?xml version=""1.0"" encoding=""utf-8""?><Swap xmlns=""http://schemas.microsoft.com/windowsazure""><Production>{0}</Production><SourceDeployment>{1}</SourceDeployment></Swap>" -f $productionDeploymentName, $stagingDeploymentName)
    $webRequest.Method = "POST"
    $webRequest.ClientCertificates.Add($global:ManagementCertificate)
    $webRequest.ContentType = "application/xml"
    $webRequest.ContentLength = $webRequestContent.length
    $webRequest.Headers.Add("x-ms-version", "2012-03-01")
    $writer = New-Object System.IO.StreamWriter($webRequest.GetRequestStream())
    $writer.Write($webRequestContent)
    $writer.Close()

    $webResponse = $webRequest.GetResponse()
    WaitForDeploymentState $serviceName 'Production' 'Running'
    WaitForRoleInstancesState $serviceName 'Production' 'ReadyRole'
0
votes

I found this when I hit the same problem.

In my script, if I want to run the Move-AzureDeployment I first check the Production slot, if it has content then I switch (having already deployed to staging earlier in the script).

In the case where Production is empty I re-deploy the current package to the Production Slot, I could optimize it to use the azure storage but it'll do for today.

In short; the docs are either wrong or there is a bug, you cannot use this cmdlet if Production is empty.