I am using the Deploy-FabricApplication.ps1 script that is generated when you create a Service Fabric project to deploy my application.
When deploying to a Service Fabric cluster I can deploy locally if I first connect to a local cluster using Connect-ServiceFabricCluster
. However, my build server does not run a local cluster instance so I am unable to first connect to a local instance. When I connect with Connect-ServiceFabricCluster @ClusterConnectionParameters
I get data back on the connection that it was successful. When it gets to the publish and runs the Test-ServiceFabricClusterConnection command I get the following error.
WARNING: Unable to Verify connection to Service Fabric cluster.
Test-ServiceFabricClusterConnection : Cluster connection instance is null
At C:\ProgramFiles\MicrosoftSDKs\ServiceFabric\Tools\PSModule\ServiceFabricSDK\Publish-NewServiceFabricApplication.ps1:129 char:16
+ [void](Test-ServiceFabricClusterConnection)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [Test-ServiceFabricClusterConnection], NullReferenceException
+ FullyQualifiedErrorId : GetClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.TestClusterConnection
I have tried removing Test-ServiceFabricClusterConnection from the Publish-NewServiceFabricApplication.ps1 module and I get a different set of errors. No matter what I have tried to this point, if I first connect to a cluster it works but not if I connect via the powershell script.
Update! Solved Solved this using dot sourcing: How do I deploy service fabric application from VSTS release pipeline?