Deploying Service Fabric Application - Bhushan-Jagtap-2013/AzureServiceFabricExamples GitHub Wiki

Tools to deploy

  • Power shell
  • MSBuild (c:\windows\Microsoft.NET\Framework\v4.0.30319\MSBuild)
  • Azure CLI

Application Package

  • [ApplicationName]\pkg\Debug

Deployment steps

Connet, Test, Upload, Register, Create Instance

Commands

Connect-ServiceFabricCluster

Test-ServiceFabricApplicationPackage - ApplicationPackagePath [Path]

Now we need to connect to image store using connection string and upload the package. Get the connection string from cluster manifest file.

$clusterManifest = Get-ServiceFabricCLusterManifest

$connectionString = Get-ImageStoreConnectionStringFromClusterManifest -CLusterManifest $clusterManifest

Copy-ServiceFabricApplicationPackage -ApplicationPcakgePath [] - ApplicationPackagePathInImageStore [] -ImageStoreConenctionString []

Register-ServiceFabricApplicationType - ApplicationPathInImageStore []

New-ServiceFabricApplication -ApplicationName "fabric:/[YourAppName]" -AppliocationTypeName [] -ApplicationTypeVersion [Check the cluster for this number]

Upgrade application

Connet, Test, Upload, Register, Upgrade

Everything is same except last step of upgrade instead of install

Start-ServiceFabricApplicationUpgrade -ApplicationName [] -ApplicationTypeVersion [] -FailureAction [Rollback/Manual] -Monitored

Get-ServiceFabricApplicationUpgrade -ApplicationName []

Remove Application

Remove application instance and them type

Remove-ServiceFabricApplication -ApplicaitonName [] - Force

Unregister-ServiceFabricApplicationType -ApplicationTypeName [] - ApplciationTypeVersion [] -Force

Continuous Integration with Azure Pipeline

  • Connect to SF cluster using Azure Dev repo by going to service connection in repo setting
  • Use Azure YAML pipeline to define your build and deploy configuration

Create new pipeline

  • Click on add new pipeline and connect to repository. Provide YML file location.