6

安装 Windows Azure Powershell(2012 年 10 月版本 0.6.7)后,我收到运行Set-AzureDeployment Cmdlet 的错误。

为 Remove-AzureDeployment 和 New-AzureDeployment 提供相同的参数可以正常工作。

删除-AzureDeployment -Slot $slot -ServiceName $serviceName -Force

New-AzureDeployment -Slot $slot -Package $packageLocation -Configuration $cloudConfigLocation -label $deploymentLabel -ServiceName $serviceName

但是,当使用带有 -Upgrade 开关和相同参数值的 Set-AzureDeployment 时,出现错误。

Set-AzureDeployment -Upgrade -Slot $slot -Package $packageLocation -Configuration $cloudConfigLocation -label $deploymentLabel -ServiceName $serviceName -Force

错误是:

+ CategoryInfo : CloseError: (:) [Set-AzureDeployment], ProtocolException

+fullyQualifiedErrorId:Microsoft.WindowsAzure.Management.ServiceManagement.HostedServices.SetAzureDeploymentCommand

捕获内部异常显示:

<Error xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Code>MissingOrIncorrectVersionHeader</Code><Message>The versioning header is not specified or was specified incorrectly.</Message></Error>

任何人都可以就可能出现的问题提供建议吗?

我试图运行的脚本是 PublishCloudService.ps1 from here

4

3 回答 3

4

我在 2012 年 10 月发布的 cmdlet 中遇到了同样的问题。打开支持票,他们表示这是一个已知问题,并指出我在 8 月发布以解决错误 - https://github.com/WindowsAzure/azure-sdk-tools/downloads。在卸载十月构建并安装八月一之后,部署开始按预期工作。

于 2012-11-15T18:49:05.367 回答
2

我是 AzurePowerShell 的新手,但我也有类似的问题,我只是通过以下方式欺骗它:

  1. 将插槽设置​​为暂存
  2. 删除当前部署(如果存在)
  3. 创建一个新的部署
  4. 交换它

这是我的 PowerShell 脚本(修改自:http ://weblogs.asp.net/srkirkland/archive/2012/09/11/ci-deployment-of-azure-web-roles-using-teamcity.aspx )

$subscription = "[Your Subscription Name]"
$service = "[Your Service Name]"
$slot = "staging" 
$package = "[Your Package File]"
$configuration = "[Your Config File]"
$timeStampFormat = "g"
$deploymentLabel = "ContinuousDeploy to $service v%build.number%"
$storageaccount = "[Your Storage Account Name]"

Write-Output "Running Azure Imports"
Import-Module "C:\Program Files (x86)\Microsoft SDKs\Windows   Azure\PowerShell\Azure\*.psd1"
Import-AzurePublishSettingsFile "[Your publishsettings file]"
Set-AzureSubscription -SubscriptionName $subscription -SubscriptionId "[Your   Subscription Id]" -CurrentStorageAccount $storageaccount
Set-AzureSubscription -DefaultSubscription $subscription

function Publish(){
 $deployment = Get-AzureDeployment -ServiceName $service -Slot $slot -ErrorVariable a -  ErrorAction silentlycontinue 

 if ($a[0] -ne $null) {
    Write-Output "$(Get-Date -f $timeStampFormat) - No deployment is detected. Creating  a new deployment. "
 }

 if ($deployment.Name -ne $null) {
    Write-Output "$(Get-Date -f $timeStampFormat) - Deployment exists in $servicename.   Upgrading deployment."
    Remove-AzureDeployment -Slot $slot -ServiceName $service -Force
 } 

 CreateNewDeployment
 Move-AzureDeployment -ServiceName $service
 }

function CreateNewDeployment()
{
    write-progress -id 3 -activity "Creating New Deployment" -Status "In progress"
    Write-Output "$(Get-Date -f $timeStampFormat) - Creating New Deployment: In   progress"

    $opstat = New-AzureDeployment -Slot $slot -Package $package -Configuration    $configuration -Label $deploymentLabel -ServiceName $service

    $completeDeployment = Get-AzureDeployment -ServiceName $service -Slot $slot
    $completeDeploymentID = $completeDeployment.deploymentid

    write-progress -id 3 -activity "Creating New Deployment" -completed -Status "Complete"
    Write-Output "$(Get-Date -f $timeStampFormat) - Creating New Deployment: Complete,    Deployment ID: $completeDeploymentID"
}

Write-Output "Create Azure Deployment"
Publish

它正在工作:)

于 2012-11-22T04:03:10.587 回答
1

我遇到了类似的问题。当我将 cspkg 独立上传到 blob 存储并使用 -Package {url-to-blob} 引用它时,升级就成功了。

我想这可能意味着它无法上传 blob 本身,因为某些设置错误,但很难说那会是什么。

你是如何捕捉到内部异常的?

于 2012-11-11T19:28:43.183 回答