We had some problems earlier today with Service Fabric ARM templates that just seemed to have stopped working. We use these templates to spin up on-demand test environments.

The problem appears to have originated in a breaking change in the ServiceFabricNodeBootstrapAgent. Our ARM script to setup a Service Fabric cluster used to work fine with agent version 1.0.0.139. However, if we do a new deployment now, we get version 1.0.0.143 of the agent which logs the following error in the event log:

1
Failed starting service, Error: System.ArgumentNullException: Value cannot be null.

I looked at the code using DotPeek and found a breaking change concerning the behaviour around the dataRoot setting (which can be used to customize the location of the SvcFab directory).

In version 1.0.0.139 of the ServiceFabricNodeBootstrapAgent, the code checks whether the dataRoot field is not null:

1
2
3
4
5
6
if (!string.IsNullOrWhiteSpace(dataRoot))
{
Trace.TraceInformation("Using user-specified data root: {0}", (object) dataRoot);
parameters.Add("FabricDataRoot", (object) dataRoot);
parameters.Add("FabricLogRoot", (object) Path.Combine(dataRoot, "Log"));
}

However, in version 1.0.0.143, this check is gone:

1
num = this.ConfigureNode(str1, str2, Path.GetFullPath(dataRoot), Path.GetFullPath(Path.Combine(dataRoot, "Log")));

In this version, dataRoot is directly passed to the Path.GetFullPath method which then throws an ArgumentNullException if the dataRoot field is not set.

So where should this dataRoot value come from? It is loaded from the current.config file that’s in the same directory as the bootstrapper service. The current.config file will only contain the value however if it has been explicitly set in the ARM template (dataPath setting of the ServiceFabricNodeBootstrapAgent):

1
2
3
4
5
6
7
8
"virtualMachineProfile": {
"extensionProfile": {
"extensions": [{
...
"properties": {
...
"settings": {
"dataPath": "D:\\\\SvcFab",

So if your Service Fabric ARM deployments are suddenly not working anymore, check if you’ve specified the dataPath setting.

I’ve opened an issue for this at https://github.com/Azure/service-fabric-issues/issues/197.