OctopusDeploy / Issues

| Public | Bug reports and known issues for Octopus Deploy and all related tools
https://octopus.com
161 stars 20 forks source link

Update the Windows Azure cmdlets to the latest version #1444

Closed hnrkndrssn closed 9 years ago

hnrkndrssn commented 9 years ago

I've been deploying my Azure cloud service with Octopus successfully for some time now but I only started experiencing an error today. I am getting the following in the task log:

Importing Windows Azure modules
Loading the management certificate
Setting up the Azure subscription
Starting the Azure deployment process
Creating a new deployment...
New-AzureDeployment : "An exception occurred when calling the 
ServiceManagement API. HTTP Status Code: 400. Service Management Error Code: 
MissingOrIncorrectVersionHeader. Message: The x-ms-version header value 
'2012-12-01' is not one of the supported version headers.. Operation Tracking 
ID: 81481a5ec9e965f39541560f072d4ab3."
At C:\Octopus\Applications\Staging\Storm.CloudService\0.2.0-stable03023_1\Deplo
yToAzure.ps1:73 char:5
+     New-AzureDeployment -Slot $OctopusAzureSlot -Package 
$OctopusAzurePackageUri ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : CloseError: (:) [New-AzureDeployment], ServiceMa 

nagementClientException


I grabbed the .cspkg and (Octopus transformed) .cscfg off the Tentacle and deployed manually to Azure successfully.

I'm not quite sure what the bit about version 2012-12-01 means since according to Microsoft's Service Management Versioning, there is no 2012-12-01.

The only thing that I've changed in my deployment is that I'm now configuring an internal load balancer as part of the cloud service configuration. This was added in version 2014-05-01 (and Azure SDK 2.4) so I wondered if perhaps Octopus was using an older version.

I tried updating the Azure SDK on the Tentacles but it did not help so I wondered if Octopus might have bundled an old version of the Azure SDK.

http://help.octopusdeploy.com/discussions/problems/29367

<!---
@huboard:{"order":0.000457763671875}
-->
richardp-au commented 9 years ago

Do you have a timeline for this? I need it urgently because I can now no longer deploy via Octopus without a manual step at the end.

Also can you guys look at either having a plan to keep these bundled cmdlets up to date or perhaps using the non-bundled Azure PS cmdlets if installed with a newer version?

vanessalove commented 9 years ago

This is actually a double up ticket. https://github.com/OctopusDeploy/Issues/issues/1385 Closing this one.

vanessalove commented 9 years ago

@richardp-au another customer did the following on their tentacle as a workaround without needing a manual step

I have solved this issue by changing the path to the Azure module in

C:\Program Files\Octopus Deploy\Tentacle\Scripts\BootstrapDeployToAzure.ps1

e.g. the line

Import-Module $OctopusAzureModulePath

becomes

Import-Module "C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1"

richardp-au commented 9 years ago

@vanessalove Awesome I'll try that. It'd be nice to have an option in Octopus to either use the bundled Azure cmdlets or the installed ones.

richardp-au commented 9 years ago

I tried the above suggestion of changing the Azure module path in the BootstrapDeployToAzure.ps1 file. However, it made no difference and I still got the error.

I then added some extra text to the Write-Host lines to check that it was using the right file with my edits and found that the extra text did not make it to the Octopus task log. (I restarted both the Tentacle service and even the computer before rerunning just in case.)

I then took a look at the BootstrapDeployToAzure.ps1 and DeployToAzure.ps1 files that get copied to the C:\Octopus\Applications\(environment)\(package)\(version)\ folder. Both of these files did not have the modifications I made so they must be coming from somewhere else.

quezlatch commented 9 years ago

@richardp-au I managed to get around this by calling the following function at the start of DeployToAzure.ps1

function PatchAzureCmdletVersion()
{
    Write-Host "Remove previous Windows Azure modules from $OctopusAzureModulePath"
    Remove-Module azure

    $OctopusAzureModulePath = "C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1"

    Write-Host "Import Windows Azure modules from $OctopusAzureModulePath"

    Import-Module $OctopusAzureModulePath

    Add-Type -AssemblyName "System"
    $certificate = new-object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @($OctopusAzureCertificateFileName, $OctopusAzureCertificatePassword)

    Write-Host "Resetting up the Azure subscription"
    Set-AzureSubscription -CurrentStorageAccount $OctopusAzureStorageAccountName -SubscriptionName $OctopusAzureSubscriptionName -SubscriptionId $OctopusAzureSubscriptionId -Certificate $certificate
    Select-AzureSubscription -SubscriptionName $OctopusAzureSubscriptionName
}
johnkattenhorn commented 9 years ago

Many Thanks @quezlatch - That's worked a treat as I need the ILB in my deploy :-)

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you think you've found a related issue, please contact our support team so we can triage your issue, and make sure it's handled appropriately.