Service Fabric deployments -Unregister Unused Versions

Hi, the Unregister Unused Versions function of the SF app deployment step is very useful, but maybe a bit too good for production environments!

Is there a way to limit the function so that it keeps a pre-defined number still registered? For example, deletes the oldest x amount of release types, but leaves the last 3 types in-place and ready should the need for rollback arise?



Thanks for getting in touch.

Our step is limited to the Service Fabric PowerShell cmdlets that our scripts call through to. The options you can set on the step are forwarded from Octopus to this Calamari script. The UnregisterUnusedVersions property is forwarded to the Publish-UpgradedServiceFabricApplication cmdlet (which is a Service Fabric SDK method) and at that point it’s out of our control.

If there are additional arguments that the SDK allows you to set that are not supported by Octopus, you can override this powershell script with your own logic, so you can customise it if necessary. But from a quick look at the SDK, we don’t see any additional parameters that gives you finer control of these unused versions.

Sorry for the bad news, but hopefully that provides some clarity about what’s happening end-to-end and maybe you can find a compromise.


Also, another option we were just considering, you could choose to not use that flag on the step and instead have a separate SF SDK PowerShell Script step in your deployment process, then you can conditionally call the unregister command yourself using PowerShell and that may give you a bit more control.

Hope this helps


Hi Mark, thanks for your comprehensive reply. Its a shame Microsoft don’t consider Production uses of their implementations at times, but hopefully at some point in the future they may build this functionality in.

Best Regards