2012-11-19 68 views
2

我使用的是從這裏開始的Windows Azure PowerShell命令v0.6.7:https://www.windowsazure.com/en-us/manage/downloads/布展AzureDeployment PowerShell命令失敗

當我運行下面的命令:

Move-AzureDeployment -ServiceName $AzureServiceName 

我得到以下錯誤:

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. 

錯誤是有點正確的,在我的Staging插槽只有一個部署。然而,對於移動-AzureDeployment的文件(http://msdn.microsoft.com/en-us/library/windowsazure/jj152834.aspx)規定:

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

前述天青PowerShell命令在同一腳本,如New-AzureDeployment,成功執行。我通過使用Set-AzureSubscription來啓動腳本來配置訂閱信息和證書。

不知道我錯過了什麼幫助表示感謝,謝謝!

回答

0

我在遇到同樣的問題時發現了這個問題。

在我的腳本中,如果我想運行Move-AzureDeployment,我首先檢查生產槽,如果它有內容,那麼我切換(已經部署到腳本的早期階段)。

在生產爲空的情況下,我將當前包重新部署到生產槽,我可以優化它以使用天藍色存儲,但它會在今天完成。

總之;文檔錯誤或存在錯誤,如果Production爲空,則不能使用此cmdlet。

2

我就遇到了這個問題,也是使出使用REST API用於交換。這裏是一個例子,如果有人感興趣。

$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' 
+2

作爲唯一一個偶然的Powershell用戶,這不是明顯對我如何加載證書。我最終解決了這個問題。我希望我能在一段時間內挽救他人的閱讀。您可以使用:$ global:ManagementCertificate = gci cert:\ CurrentUser \ My \ 其中是證書指紋。這假定證書已安裝在您的個人商店中。 –