We have been having several deploy issues and have been working directly with Microsoft on them. They have identified the issues and have proposed workarounds for us pending Azure updates with the fixes for the issues being included. One of the workarounds is to use a multi-phase slot swap using the Switch-AzureRmWebAppSlot commandlet. I have upgraded the Windows management framework to 5.0 plus have installed the 2.3.0 modules AzureRM.Websites and AzureRM.profile. We now get the error “Switch-AzureRmWebAppSlot : Run Login-AzureRmAccount to login.” Running the same script from the powershell ISE it runs successfully.
Any ideas what is happening here that this is not functioning correctly from Octopus?
Please see attached screen shots below.
Thanks for getting in touch! I’ve followed you detailed report but I couldn’t reproduce your problem. The deployment worked for me.
Can you review my steps and compare them to your setup? If you already do what I do then please send me [the raw log] (http://docs.octopusdeploy.com/display/OD/Get+the+raw+output+from+a+task) of your deployment. Also please add
Get-Module -ListAvailable -Name Azure* to the top of your PowerShell script so we can verify that the correct Azure Modules are loaded.
- Downloaded the lastet version of Octopus: 3.5.2.
- Created a Web App in Azure
- Created a new slot called Staging
- Created an Azure acccount in Octopus that uses Service Principal authentication method
- Created a new deployment process and added “Run an Azure PowerShell Script”(content attached)
- The version of PowerShell modules in Octopus is a bit out of date so I installed the latest version using Web Platform Installer
- Added a new variable
Octopus.Action.Azure.UseBundledAzurePowerShellModules and set its value to
False to use the version of PowerShell modules I just installed
- Run the script and it succeeded (I attached the full log)
Please let me know how you go.
Pawel_Log.txt (67 KB)
Thanks for your reply. I was just missing step 7 in your process below. Adding that variable resolved the issues I was seeing.
From: Pawel Pabich [mailto:firstname.lastname@example.org]
Sent: Thursday, November 24, 2016 3:29 PM
To: Kunze, Michael Michael.Kunze@pattersoncompanies.com
Subject: Re: Slot swap fails with message: “Switch-AzureRmWebAppSlot : Run Login-AzureRmAccount to login.” [Problems #49207]
*** External Email ***
I’m glad you’ve solved your problem.