function Start-AlkamiServiceFabricClusterUpgrade { <# .SYNOPSIS Updates the Service Fabric runtime version. .PARAMETER hostname A single server from the cluster that needs to be upgraded. #> [CmdletBinding()] Param( [Parameter(Mandatory = $false)] [string]$hostname = "localhost" ) $loglead = Get-LogLeadName; Connect-AlkamiServiceFabricCluster -hostname $hostname; Write-Host "$loglead Updating Service Fabric runtime version."; [array]$versions = (Get-ServiceFabricRegisteredClusterCodeVersion | Select-Object -ExpandProperty CodeVersion | Sort-Object -Descending); foreach($version in $versions) { Write-Verbose "$loglead Found version $version"; } $largestVersion = $versions[0]; Write-Host "$loglead Selecting Service Fabric upgrade version $largestVersion. Starting upgrade."; Start-ServiceFabricClusterUpgrade -Code -CodePackageVersion $largestVersion -Monitored -FailureAction Rollback; Write-Host "$loglead Cluster upgrade started. Progress can be monitored through the dashboard."; }