Deploying an application with Azure CI/CD pipeline to a Service Fabric cluster
Published Dec 08 2022 02:24 AM 4,043 Views




Before you begin this tutorial:


Configure the Application on the Visual Studio 2019


  1. Clone the Voting Application from the link-




  1. After that we can enter link to clone the voting application.



  1. Once you click on Clone button, we can see that application is ready to open on Solution Explorer.



  1. Now we have to build the solution so that all the dependency DLL will be downloaded on the package folder from NuGet store.
  2. We need to cross check the NuGet package solution to find if any DLL is deprecated. If so, then we need to update all older version of DLL.



  1. After correcting the DLL version, we have to check the application file 'voting.sfproj'


Note – For Visual Studio 2022, toolsVersion will be 16.0 and we have to update the MS build version everywhere in the 'voting.sfproj' file.


  1. From packages.config file, we can get the MS build version:


  1. We must cross check the dotnet version in 'packages.config' of the application and also at the service level.
  2. Like in 'packages.config' is having the net40 but in service dotnet version net472.


  1. We have to manually add the reference of MS build in service project file.

Example –



  1. Expected error based on above changes –



  1. We must push our changes to our repo. However, prior that we must take care that we should not push our changes on master branch. We need to create a new branch and push our changes to that branch.
  2. For that, In Visual Studio we can go to Team Explorer





  1. After that sync the local branch on DevOps repo.
  2. Now we have to create a Pipeline – Click on New Pipeline



  1. Then click in Use Classic Editor --> select the repository.




  1. Select the template – search for Service Fabric template-



  1. After that all the Task will be generated.



  1. In Agent Specification we need to select the same version as Visual Studio version. Like we have selected the 2019 because we have built the project on VS 2019.
  2. Use NuGet latest stable version. At time of this blog creation, NuGet version is 5.5.1. Also uncheck the checkbox  “Always download the latest matching version”.
  3. In Build solution we must select 2019 as my Visual Studio version is 2019.
  4.  In “Update Service Fabric Manifest” task we can directly change the version in manifest.
  5. In Copy files – we can gather the data from application manifest and application parameters file.

Please refer below image for above points (19-23)


  1. Enable continuous integration checkbox, so that whenever we do any commit on the repo Automatically the build pipeline is triggered.



  1. We can add some static variables while executing the pipeline by putting the value in variable.

Build Success mail –





Build failed mail-



Release Pipeline-


  1. Release pipeline is the final step where application is deployed to the cluster.



       2. Click on “New Release Pipeline” then again select the template for Service Fabric.




       3. Then add the Artifact by selecting the correct build pipeline.

PritamSinha_23-1673952278686.png     4. Click on 1 job,1 task


      5. Click on stages --> then we have to select the cluster connection. If no cluster connection is created, then click on “New”




     6. Create a Service Connection as given in below image-






Note: - For Azure Active Directory credentials, add the Server certificate thumbprint of the server certificate used to create the cluster and the credentials you want to use to connect to the cluster in the Username and Password fields.


     7. How to generate the client certificate value –

  • Open to PowerShell ISE with Admin access.
  • Paste the command- [System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes("C:\Users\pritamsinha\Downloads\certi\certestuskv.pfx").
  • Paste the output in the same PowerShell workspace area and remove all the space from beginning and end.



     8. In case of some error with base 64 value then deployment will fail-




  1. Enable Grant access permission to all pipelines.

Note – in case when cluster certificate is expired, and we have updated the cluster certificate then we need to update the thumbprint and client certificate value.


  1. Post above, Deploy Service Fabric application section –





  • In Application Parameter – We need to select the target location of the file where the application parameter file is placed.
  • Enable compressed package so that application package will be converted to zip file.
  • CopyPackageTimeoutSec-Timeout in seconds for copying application package to image store. If specified, this will override the value in the published profile.
  • RegisterPackageTimeoutSec -Timeout in seconds for registering or un-registering application package.
  • Enable the Skip upgrade for same Type and Version (Indicates whether an upgrade will be skipped if the same application type and version already exists in the cluster, otherwise the upgrade fails during validation. If enabled, re-deployments are idempotent.)
  • Enable the Unregister Unused Versions (Indicates whether all unused versions of the application type will be removed after an upgrade.)
  1. Configure the “Continuous deployment trigger” –



Then save the config and run the release pipeline.


  1. Expected output-







Azure pipeline reference link -

Service Fabric Azure CICD pipeline doc-


1 Comment
Version history
Last update:
‎Jan 17 2023 03:03 AM
Updated by: