In my last article we discovered how to use Azure Container Registry to store Docker images. We stored in a our private registry 3 Docker images: Elastic Search, Kibana and an Nginx proxy. In this article we are going to host our containerized log server in Azure Service Fabric Mesh.


Azure Service Fabric Mesh Overview

Azure Service Fabric is the Microsoft Microservice Engine. It’s a powerful engine that we can use to host and orchestrate our Windows and Linux microservices. In its classic version an Azure Service Fabric cluster defines a set of nodes in one or several Azure VM scale set, IaaS management is needed an weed to care about horizontal scaling.

Azure Service Fabric Mesh is the Serverless version of the Azure Service Fabric engine: That means that we can deploy and run containerized microservices without caring about the underlying infrastructure. We just have to create containers, specify the resources needed to make them run and the SF Mesh engine will manage the high availability and containers horizontal scaling.


Azure resources needed

To understand which Azure Resources we have to deploy, let’s explain quickly how a service Fabric mesh app works: An SF mesh app is a collection of containers (called services) running inside a private network. This network is by default not accessible from outside, that’s why we need a gateway to access the network from the web. The gateway defines which service is exposed in a public way and which protocol we have to use to access it (Http or Tcp).

A Service is basically a container hosted in a registry. For each service we have to define following options:

  • The target registry and the docker image
  • Container properties (environment variables, volume…)
  • An endpoint on the network to contact the service over the network
  • Resources needed (CPU and memory)
  • Replica count


We are going to define a service for each Docker image stored in our private Docker registry (Kibana, Elasticsearch, Nginx). The elastic search service will use an SF mesh volume.

An SF volume needs an Azure storage account to be configured, let’s create one.The following script creates an Azure Storage Account with an Azure File Share.

$resourceGroupName = ''
$storageAccountName = ''
$location = ''
$storageAccountFileShareName = ''

az storage account create -n $storageAccountName -g $resourceGroupName -l $location --sku Standard_LRS
storageConnexionString=$(az storage account show-connection-string -n $storageAccountName -g $resourceGroupName --query 'connectionString' -o tsv)
storagePrimaryKey=$(az storage account keys list --resource-group $resourceGroupName --account-name $storageAccountName --query "[0].value" | tr -d '"')

az storage share create --name $storageAccountFileShareName --connection-string $storageConnexionString


We will use the storage account name, it’s access key and the azure file share name in the deployment template parameter file.


ARM Template deployment

To deploy our log server, we are going to use an ARM (Azure Resource Manager) template with 4 types of resources:

  1. Network (Microsoft.ServiceFabricMesh/networks)
  2. Gateway (Microsoft.ServiceFabricMesh/gateways)
  3. Application (Microsoft.ServiceFabricMesh/applications) with services as linked resources
  4. Volume (Microsoft.ServiceFabricMesh/volume)


This ARM template is quite big and pasting it in the current post would not be readable, you can find it here. It’s output will give us the gateway IP address that correspond to the entry point of our log server.

In the following schema arrows symbolize “depends on” relations :


The template parameter file specifies registry credentials, private repositories to use to get elastic search, kibana and nginx images and storage account information (to set up the Docker volume):



Deploy the Service Fabric Mesh app

Now that the ARM template is built and ready to use, only one line of azure cli will help us to deploy our log server. Make sure you have the az cli mesh extension installed (if not, you can install it using the following line az extension add –name mesh).


In the following script, we are using the az mesh deployment create command. We have to specify the target resource group, the deployment template file and the parameter file :

az mesh deployment create --resource-group {resourceGroupName} --template-file ./azuredeploy.full.json --parameters ./azuredeploy.parameters.json


Once the deployment done, we can get the public IP of the gateway provided as deployment output and we use our log server.


Happy coding 🙂

Deploy Service Fabric applications to local cluster using PowerShell Hosting an Elastic Search log server in a serverless Architecture - Discovering Azure Container Registry (ACR)

Leave a Reply

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *