[Service Fabric] Unable to determine whether the application is installed on the cluster or not


I was working with a customer that was attempting to deploy a simple Service Fabric application from within Visual Studio 2015 to a secure cluster in Azure.

The cluster itself was secured via an .X509 certificate stored in Azure Key Vault. There were currently no applications deployed to the Azure cluster.

When we opened up the publish dialog in Visual Studio, the first thing we noticed was the red circular 'x' icon over to the right of the name of the cluster endpoint address. The error message shown here is actually a pretty common one that can be caused by connectivity issues with the remote cluster 'Failed to contact the server. Please try again later or get help from "How to configure secure connections"



We decided first to confirm that the thumbprint was correct and that it was installed on the machine from where the deployment was being attempted.

We then decided to go ahead and attempt to publish the app to the Azure cluster just to see what happens and see what error message appears. In the output window, we saw this:


1>------ Build started: Project: HealthApp, Configuration: Debug x64 ------

2>------ Publish started: Project: HealthApp, Configuration: Debug x64 ------

2>Unable to determine whether the application is installed on the cluster or not

========== Build: 1 succeeded, 0 failed, 3 up-to-date, 0 skipped ==========

========== Publish: 0 succeeded, 1 failed, 0 skipped ==========


Strange error. Was Visual Studio actually connecting to the cluster and then could not confirm that the app was there or was Visual Studio actually NOT connecting to the cluster so of course, it could not determine if the app was there?

To make sure that from the deployment machine we could actually connect to the cluster, we opened PowerShell ISE (as an administrator) and ran the following command:


$ClusterName= "myclustername.eastus.cloudapp.azure.com:19000"

$CertThumbprint= "<my-certificate-thumbprint>"

Connect-serviceFabricCluster -ConnectionEndpoint $ClusterName -KeepAliveIntervalInSec 10 `

-X509Credential `

-ServerCertThumbprint $CertThumbprint `

-FindType FindByThumbprint `

-FindValue $CertThumbprint `

-StoreLocation CurrentUser `

-StoreName My


We confirmed cluster connectivity:


What ensued over the next few hours were redeployments of certificates, testing other apps for deployment, testing from other machines.


Eventually we discovered that the problem was there was a hidden white space in front of the value for the thumbprint in the publish dialog:


And when I say hidden, I mean there was no indication at all that there was anything there. Until we manually re-entered the certificate thumbprint and tried a new deployment, it still appeared that Visual Studio did not have connectivity to the cluster. Once we deployed successfully, the red icon went away.


Hope this helps you in your work with Azure Service Fabric!