"Login-AzureRmAccount : Exception has been thrown" after Upgrade to latest version

reliability
(Ict Support) #1

Hi,

After upgrading to the latest version 2019.9.1 LTS We are getting an error with trying to Deploy to Azure.
Full (Redacted) Details of the Error in the WebUI

Extracting package ‘D:\Octopus\Packages\Spaces-1\feeds-builtin*******.nupkg’ to
‘D:\Octopus\Work\20191011043746-119267-8’
October 11th 2019 15:37:50 Info Mode : Process
October 11th 2019 15:37:50 Info ContextDirectory :
October 11th 2019 15:37:50 Info ContextFile :
October 11th 2019 15:37:50 Info CacheDirectory :
October 11th 2019 15:37:50 Info CacheFile :
October 11th 2019 15:37:50 Info Settings : {}
October 11th 2019 15:38:13 Error Login-AzureRmAccount : Exception has been thrown by the target of an invocation.
October 11th 2019 15:38:13 Error At D:\Octopus\Work\20191011043746-119267-8\Octopus.AzureContext.ps1:83 char:13
October 11th 2019 15:38:13 Error + Login-AzureRmAccount -Credential $creds -TenantId $Octopu …
October 11th 2019 15:38:13 Error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
October 11th 2019 15:38:13 Error + CategoryInfo : CloseError: (:slight_smile: [Connect-AzureRmAccount], TargetInvocationException
October 11th 2019 15:38:13 Error + FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand
October 11th 2019 15:38:13 Error
October 11th 2019 15:38:13 Fatal The remote script failed with exit code 1
October 11th 2019 15:38:13 Fatal The action Build EDI Docker Image on the Octopus Server failed

I have run the powershell in debug and manually run the sections of ‘Octopus.AzureContext.ps1’
The main part of which is (variables omitted):

$securePassword = ConvertTo-SecureString $OctopusAzureADPassword -AsPlainText -Force
$creds = New-Object System.Management.Automation.PSCredential ($OctopusAzureADClientId,
$securePassword)
$AzureEnvironment = Get-AzureRmEnvironment -Name $OctopusAzureEnvironment
Login-AzureRmAccount -Credential $creds -TenantId $OctopusAzureADTenantId -SubscriptionId
$OctopusAzureSubscriptionId -Environment $AzureEnvironment -ServicePrincipal

All the variables check out and when it gets to the Login-AzureRmAccount is pauses for ~30s then returns

The background process reported an error with the following message: "The named pipe target
process has end
+ CategoryInfo : ResourceUnavailable: ( : ) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : System.Management.Automation.Remoting.PSRemotingDataStructureException

I ran the script in a standard powershell window and it logins in OK so I know the credentials are OK (and are unchanged since before upgrade as well)

I’m currently stuck on where to look next and we’re unable to deploy at the moment.

Thanks

(Kenneth Bates) #3

Hi @ict.support,

Thanks for getting in touch! I’m sorry to hear you’re hitting this unexpected issue - this certainly does seem head scratching.

When you tested this and confirmed it logs in in a standard PowerShell window, were you using the same user that’s running the Octopus service, and on the Octopus server machine itself? Are you using a custom Azure module version in your project?

I look forward to hearing back and getting to the bottom of this one!

Best regards,

Kenny