安装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>
有人可以就可能出错的地方提供建议吗?
我尝试运行的脚本是来自here的PublishCloudService.ps1。
答案 0 :(得分:4)
我在2012年10月发布的cmdlet时遇到了同样的问题。打开支持票,他们表示这是一个知道问题,并指出我在8月份的版本中解决错误 - https://github.com/WindowsAzure/azure-sdk-tools/downloads。卸载10月构建并安装8月后,部署开始按预期工作。
答案 1 :(得分:2)
我是AzurePowerShell的新手,但我也有类似的问题,我只是骗过它:
这是我的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
它正在发挥作用:)
答案 2 :(得分:1)
我遇到了类似的问题。当我将cspkg独立上传到blob存储,并使用-Package {url-to-blob}引用它时,升级工作正常。
我想这可能意味着它无法上传blob本身,因为某些设置错误,但很难说它会是什么。
你是如何捕获内部异常的?