Getting Started with Azure Service Fabric

if you only want to get started quickly, just jump ahead to “Setting up a Development Environment” section

I have been experimenting with container orchestrators to help me deploy a microservices-style hobby project I have been working on (more on this in a separate blog post) to the cloud. If there’s one thing I learnt from this project, there are a lot of moving parts to it and might not be easy to manage a distributed cluster with hundreds of services that are fast, reliable and scaling.

While I was on the journey in finding a platform/framework with a good balance of container orchestration, managing and monitoring infrastructure, I came across Azure Service Fabric which looked promising.

The following definition is the one that caught my eye,

The aim of Service Fabric is to solve the hard problems of building and running a service and to use infrastructure resources efficiently, so teams can solve business problems by using a microservices approach. Service Fabric is agnostic about how you build your service, and you can use any technology. But it does provide built-in programming APIs that make it easier to build microservices.

For starters, you can have a quick look at Microsoft’s official page to learn more about Azure Service Fabric.


Options in Azure for Microservices

Here’s a quick summary of different options you can use to build microservices type applications in Azure,

  • AKS: Microsoft’s Managed Kubernetes service with Docker as runtime
  • Service Fabric: Another step forward from AKS. All about microservices and, – Service communication – Service discovery – Monitoring and Telemetry – Provision and upgrade – Testing locally – Scalability – Manage downtimes
    • Focus on business objectives and infrastructure. In AKS you need to build your infrastructure. Build and deploy from day1, but still be able to customize.
    • Proven tech – Many azure services run on ASF. Cosmos DB, Azure SQL, Power BI, Skype, IoT Hub, Cortana, ACR, Azure DevOps
  • Azure Functions – Mini version of microservices. Event-driven (triggers, scheduled). Easier to get started than Azure Service Fabric and Azure Kubernetes Service

Supported Environments

  • Public CloudsService Fabric is designed to run on any cloud platform other than Azure, such as AWS, GCP etc. However, as you might have already guessed, Azure has first-class support.
  • On PremiseIf you want to manage your own premise cluster, ASF supports Windows Server 2012 R2, 2016 or higher, Linux Ubuntu 16.04 and 18.04. However, when it comes to Macs, you are kind of on your own since you will have to rely on an emulator for that.
  • Developer WorkstationService Fabric does not have a dependency on Visual Studio since it’s designed to be modular. This is great because you can have a similar setup to your production environment in your development machine. It also brings you much good stuff such as simulating real-life disasters and fixing issues before they go into production!

Programming Models

Azure service fabric provides us with different ways to wrap our services in. Here’s a summary of programming models used in Service Fabric.

Setting up a Development Environment

To set up your local environment, we need to first install the necessary tooling. You can also have a look at Service Fabric’s official documentation on getting started.

Make sure you follow these steps,

  1. Install Visual Studio 2019 – Community edition is fine. In fact, you can use an editor such as Visual Studio Code. But it would be easier to use VS to get something up and running.
  2. Install Service Fabric tooling./2-installing-tools.png
  3. Install Service Fabric SDK – If you run Visual Studio and try to create a new Service Fabric project it will ask you whether you want to install the Service Fabric. However, you can also install the SDK with the Microsoft Web Platform Installer (don’t forget to scroll down to Download Web PI section)./3-installing-sdk.png

Verifying your local setup

Once you have installed the prerequisites, you can open up Visual Studio and select Create a new project

Visual Studio 2019

In the Create a new project dialog, filter by typing “fabric” and select Service Fabric Application

Create a new project

Enter a project name. You don’t need to worry about Framework version unless you are working on a classic ASP application.

Configure your new project

You will get another popup to select a project type. For this demo, we will select Stateless Service and enter a name for our project.

Create a new service fabric service

In your solution explorer you will find 2 projects like so, you can also double check with my repo if you managed to get this far.

Solution Explorer

The first project is just a wrapper around the Verification Project. If you open up Verification.cs you will see that in RunAsync method is the main entry point of our stateless console app. Hit F5 and see whether your local cluster is working fine. It may take about 2 – 3 mins initially.

Once everything is up and running, you will see the following output in Visual Studio. Put a breakpoint in your code and have a play around it.


Now open up a browser and navigate to http://localhost:19080/

You will be able to see that your application is running in a healthy state in your local cluster.

Congratulations for making it this far! Stay tuned for my next post on deploying a multi-container application to Azure with Service Fabric



About the Author:

Sahan Serasinghe is a software developer, consulting mainly in .NET technologies at Telstra Purple, Australia. He has been working as a professional software developer for the past 6 years ranging from large-scale CRMs, national security and law enforcement systems. He is currently pursuing his Master’s degree in Computer Science at University of Illinois Urbana-Champaign, USA. You will find him blogging at, sharing his thoughts and knowledge in Azure and .NET space.

You can reach him on:


Serasinghe, S. (2020). Getting Started with Azure Service Fabric. Available at: [Accsessed: 18th May 2020].

Check out more great Azure content here

Share this on...

Rate this Post: