Reputation: 259
I have configured a CI build for a Service Fabric application, in Visual Studio Team Services, according to this documentation: https://azure.microsoft.com/en-us/documentation/articles/service-fabric-set-up-continuous-integration.
However I've changed the deployment portion specified on the document above. As I want to deploy on my previously created remote azure cluster so I call the Deploy-FabricApplication.ps1 with the required parameters using power shell. But unfortunately this is not working. I'm getting the below error:
[void](Connect-ServiceFabricCluster @ClusterConnectionParameters) InvalidOperation: (:) [Connect-ServiceFabricCluster], FabricException FullyQualifiedErrorId : CreateClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.ConnectCluster
WARNING: Unable to Verify connection to Service Fabric cluster.
[error]Test-ServiceFabricClusterConnection : Cluster connection instance is null [error]At C:\Program Files\Microsoft SDKs\Service [error]Fabric\Tools\PSModule\ServiceFabricSDK\Publish-NewServiceFabricApplication.ps1:119 char:16 void : ResourceUnavailable: (:) [Test-ServiceFabricClusterConnection], NullReferenceException FullyQualifiedErrorId : GetClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.TestClusterConnection
I can deploy successfully using visual studio. Even if I run the Deploy-FabricApplication.ps1 from the build machine using power shell the application gets deployed without any error. But only if I run it using VSTS build step (part of CI), then the error mentioned above occurs.
Please note that as per the suggestion of Charisk on another stackoverflow thread I've modified the Deploy-FabricApplication.ps1 file to put the below line after line 169. $global:clusterConnection = $clusterConnection
This doesn't help either. Thanks in advance for your kind help.
Upvotes: 2
Views: 2874
Reputation: 10802
In your publish profile http://s30.postimg.org/bttleqitd/cloud.jpg you use StoreLocation="CurrentUser"
but if you followed https://azure.microsoft.com/en-us/documentation/articles/service-fabric-set-up-continuous-integration and specifically the Import your automation certificate section under Set up your build machine then you probably have imported your certificate to the LocalMachine
store location.
Simply change StoreLocation
in your publish profile from CurrentUser
to LocalMachine
and you should be good to go.
Upvotes: 2
Reputation: 29976
dot source notation means call the script with . "xxx.ps1". Refer to this link for details: PowerShell – What is dot sourcing and why use it?
Upvotes: 0