Passing application name as a parameter while deploying to service fabric cluster

Hello,

We use a self-hosted agent to deploy to the service fabric cluster. We are trying to override the application name during publishing using ‘Deploy-FabricApplication.ps1’. However when using Publish-NewServiceFabricApplication with “RegisterAndUpgrade” and setting ApplicationName as a parameter results in the following error. But it works fine when using the action “RegisterAndCreate”

Error :

InvalidArgument: Parameter set cannot be resolved using the specified named parameters.
November 4th 2022 00:31:30Error
At F:\Octopus Deploy\Home\Work\20221104052944-221922-2291\staging\Octopus.FunctionAppenderContext.ps1:211 char:1
November 4th 2022 00:31:30Error

  • Invoke-Expression “. "$OctopusFunctionAppenderTargetScript” $Octopu …
    November 4th 2022 00:31:30Error

November 4th 2022 00:31:30Error
at , F:\Octopus Deploy\Home\Work\20221104052944-221922-2291\staging\OctopusDeploy-FabricApplication.ps1: line 748
November 4th 2022 00:31:30Error
at , : line 1
November 4th 2022 00:31:30Error
at , F:\Octopus Deploy\Home\Work\20221104052944-221922-2291\staging\Octopus.FunctionAppenderContext.ps1: line 211
November 4th 2022 00:31:30Error
at , : line 1
November 4th 2022 00:31:30Error
at , F:\Octopus Deploy\Home\Work\20221104052944-221922-2291\staging\Octopus.AzureContext.ps1: line 243
November 4th 2022 00:31:30Error
at , F:\Octopus Deploy\Home\Work\20221104052944-221922-2291\staging\Bootstrap.Octopus.AzureContext.ps1: line 3141
November 4th 2022 00:31:30Error
at , : line 1
November 4th 2022 00:31:30Error
at , : line 1
November 4th 2022 00:31:30Error
Running rollback behaviours…
November 4th 2022 00:31:31Error
Script returned non-zero exit code: 1.
November 4th 2022 00:31:31Fatal
The remote script failed with exit code 1
November 4th 2022 00:31:31Fatal
The action Deploy Renweb Identity4App to US-East on the Octopus Server failed

Script snippet :

$PublishParameters[‘ApplicationName’] = $ApplicationName

Works :
$Action = “RegisterAndCreate”
$PublishParameters[‘Action’] = $Action

Publish-NewServiceFabricApplication @PublishParameters

Does not work :
$Action = “RegisterAndUpgrade”
$PublishParameters[‘Action’] = $Action

Publish-NewServiceFabricApplication @PublishParameters
Publish-UpgradedServiceFabricApplication -ApplicationName $ApplicationName -ApplicationPackagePath $ApplicationPackagePath -ApplicationParameterFilePath $publishProfile.ApplicationParameterFile -Action $Action -UpgradeParameters $UpgradeParameters -ApplicationParameter $ApplicationParameter -UnregisterUnusedVersions:$UnregisterUnusedApplicationVersionsAfterUpgrade -ErrorAction Stop

Was hoping to get a link to some document on how we can override the application name during upgrade mode

Hi @vveerappan,

Thanks for reaching out and sorry to hear you’re experiencing issues.

In order to get a better understanding of what’s going on, would you be able to share the process JSON for the project, as well as the full raw task log that the excerpt you included above is from?

To upload them securely, please use our secure support files repository, which can be found here: vveerappan | Support Files.

Hopefully with the above information we can look over the configuration of the process and see what’s going wrong in terms of the application name on RegisterAndUpgrade calls.

Kind Regards,
Adam

Updated .

Hey @vveerappan,

Thanks for sending over the files, we’ll have a look over them and get back to you once we have more information.

In the mean time, please don’t hesitate to reach out if you have any questions.

Kind Regards,
Adam

Hi @vveerappan,

I’ve had a look at the task log that has been sent over and I can see that the process step type used is “Run an Azure Script”.
May I ask, does this script work as expected when executed outside of Octopus, say from a different machine/workstation?

It’s difficult to pinpoint exactly what’s going wrong without seeing the script itself, so if you’re able to run it successfully outside of Octopus we can confirm that introducing Octopus into the scenario is causing issues and proceed with troubleshooting from there.

As an aside, there’s a step that is built into Octopus for deploying Service Fabric applications (Deploy a Service Fabric App), have you considered using this step or is it not suitable for your use-case?

Kind Regards,
Adam