Wednesday, 19 October 2016

Force Service Fabric application delete

Usually you can easily delete an application from your Service Fabric cluster using the cluster explorer. However, there are times when this doesn't work - this may happen if one of services breaks and it can't heal itself.
In such situation you can use following PowerShell script to force the delete operation:
Connect-ServiceFabricCluster -ConnectionEndpoint <your-cluster-connection-endpoint>
$nodes = Get-ServiceFabricNode
foreach($node in $nodes)
    $replicas = Get-ServiceFabricDeployedReplica -NodeName $node.NodeName -ApplicationName "fabric:/Your-App"
    foreach ($replica in $replicas)
        Remove-ServiceFabricReplica -ForceRemove -NodeName $node.NodeName -PartitionId $replica.Partitionid -ReplicaOrInstanceId $replica.ReplicaOrInstanceId

No comments: