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/documentati
When the Connect-ServiceFabricCluster
function is called (from Deploy-FabricApplication.ps1) a local $clusterConnection
variable is set after the call to Connect-ServiceFabricCluster
. You can see that using Get-Variable
.
Unfortunately there is logic in some of the SDK scripts that expect that variable to be set but because they run in a different scope, that local variable isn't available.
It works in Visual Studio because the Deploy-FabricApplication.ps1 script is called using dot source notation, which puts the $clusterConnection
variable in the current scope.
I'm not sure if there is a way to use dot sourcing when running a script though the release pipeline but you could, as a workaround, make the $clusterConnection
variable global right after it's been set via the Connect-ServiceFabricCluster
call. Edit your Deploy-FabricApplication.ps1
script and add the following line after the connection logic (~line 169):
$global:clusterConnection = $clusterConnection
By the way, you might want to consider setting up custom build/release tasks that deploy a Service Fabric application, rather than using the various Deploy-FabricApplication.ps1 scripts.