Skip to content

Instantly share code, notes, and snippets.

@valeryjacobs
Created October 14, 2016 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save valeryjacobs/ba65d7a015ab691bdc6479ececd33e4a to your computer and use it in GitHub Desktop.
Save valeryjacobs/ba65d7a015ab691bdc6479ececd33e4a to your computer and use it in GitHub Desktop.
Service Fabric Cluster ARM Tempalte
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUserName": {
"type": "string",
"metadata": {
"description": "Remote desktop user Id"
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "Remote desktop user password"
}
},
"certificateThumbprint": {
"type": "string"
},
"sourceVaultResourceId": {
"type": "string",
"metadata": {
"description": "Resource ID of the key vault where cluster certificate is stored. The format is /subscriptions/<subscription ID>/resourceGroups/<resource group name>/providers/Microsoft.KeyVault/vaults/<vault name>"
}
},
"certificateUrlValue": {
"type": "string",
"metadata": {
"description": "Refers to the location URL in your key vault where the cluster certificate was uploaded. The format is https://<name of the vault>.vault.azure.net:443/secrets/<exact location>"
}
}
},
"variables": {
"clusterName": "[concat('cluster', uniqueString(resourceGroup().id))]",
"vmStorageAccountName": "[concat('vms', uniqueString(resourceGroup().id))]",
"virtualNetworkName": "VNet",
"addressPrefix": "10.0.0.0/16",
"subnet1Name": "Subnet-1",
"subnet2Name": "Subnet-2",
"subnet1Prefix": "10.0.0.0/24",
"subnet2Prefix": "10.0.1.0/24",
"lbName": "[concat('LoadBalancer-', variables('clusterName'), '-', variables('vmNodeType0Name'))]",
"lbIPName": "PublicIP-LB-FE-0",
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]",
"subnet1Ref": "[concat(variables('vnetID'), '/subnets/', variables('subnet1Name'))]",
"supportLogStorageAccountName": "[concat('logs', uniqueString(resourceGroup().id))]",
"applicationDiagnosticsStorageAccountName": "[concat('diags', uniqueString(resourceGroup().id))]",
"lbID0": "[resourceId('Microsoft.Network/loadBalancers', variables('lbName'))]",
"lbIPConfig0": "[concat(variables('lbID0'), '/frontendIPConfigurations/LoadBalancerIPConfig')]",
"lbPoolID0": "[concat(variables('lbID0'), '/backendAddressPools/LoadBalancerBEAddressPool')]",
"lbProbeID0": "[concat(variables('lbID0'), '/probes/FabricGatewayProbe')]",
"lbHttpProbeID0": "[concat(variables('lbID0'), '/probes/FabricHttpGatewayProbe')]",
"lbNatPoolID0": "[concat(variables('lbID0'), '/inboundNatPools/LoadBalancerBEAddressNatPool')]",
"vmNodeType0Name": "nt1vm",
"fabricTcpGatewayPort": "19000",
"fabricHttpGatewayPort": "19080",
"loadBalancedAppPort1": "80",
"loadBalancedAppPort2": "8081",
"certificateStoreValue": "My"
},
"resources": [
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('vmStorageAccountName')]",
"location": "[resourceGroup().location]",
"tags": {
"resourceType": "Service Fabric",
"clusterName": "[variables('clusterName')]",
"displayName": "VMStorageAccount"
},
"properties": {
"accountType": "Standard_LRS"
}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('supportLogStorageAccountName')]",
"location": "[resourceGroup().location]",
"tags": {
"resourceType": "Service Fabric",
"clusterName": "[variables('clusterName')]",
"displayName": "SupportLogStorageAccount"
},
"properties": {
"accountType": "Standard_LRS"
}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('applicationDiagnosticsStorageAccountName')]",
"location": "[resourceGroup().location]",
"tags": {
"resourceType": "Service Fabric",
"clusterName": "[variables('clusterName')]",
"displayName": "DiagnosticsStorageAccount"
},
"properties": {
"accountType": "Standard_LRS"
}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"location": "[resourceGroup().location]",
"tags": {
"resourceType": "Service Fabric",
"clusterName": "[variables('clusterName')]",
"displayName": "VirtualNetwork"
},
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnet1Name')]",
"properties": {
"addressPrefix": "[variables('subnet1Prefix')]"
}
},
{
"name": "[variables('subnet2Name')]",
"properties": {
"addressPrefix": "[variables('subnet2Prefix')]"
}
}
]
}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('lbIPName')]",
"location": "[resourceGroup().location]",
"tags": {
"resourceType": "Service Fabric",
"clusterName": "[variables('clusterName')]",
"displayName": "PublicIPAddress"
},
"properties": {
"dnsSettings": {
"domainNameLabel": "[variables('clusterName')]"
},
"publicIPAllocationMethod": "Dynamic"
}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Network/loadBalancers",
"name": "[variables('lbName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[variables('lbIPName')]"
],
"tags": {
"resourceType": "Service Fabric",
"clusterName": "[variables('clusterName')]",
"displayName": "LoadBalancer"
},
"properties": {
"frontendIPConfigurations": [
{
"name": "LoadBalancerIPConfig",
"properties": {
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('lbIPName'))]"
}
}
}
],
"backendAddressPools": [
{
"name": "LoadBalancerBEAddressPool"
}
],
"loadBalancingRules": [
{
"name": "LBRule",
"properties": {
"backendAddressPool": {
"id": "[variables('lbPoolID0')]"
},
"backendPort": "[variables('fabricTcpGatewayPort')]",
"enableFloatingIP": false,
"frontendIPConfiguration": {
"id": "[variables('lbIPConfig0')]"
},
"frontendPort": "[variables('fabricTcpGatewayPort')]",
"idleTimeoutInMinutes": 5,
"probe": {
"id": "[variables('lbProbeID0')]"
},
"protocol": "Tcp"
}
},
{
"name": "LBHttpRule",
"properties": {
"backendAddressPool": {
"id": "[variables('lbPoolID0')]"
},
"backendPort": "[variables('fabricHttpGatewayPort')]",
"enableFloatingIP": false,
"frontendIPConfiguration": {
"id": "[variables('lbIPConfig0')]"
},
"frontendPort": "[variables('fabricHttpGatewayPort')]",
"idleTimeoutInMinutes": 5,
"probe": {
"id": "[variables('lbHttpProbeID0')]"
},
"protocol": "Tcp"
}
},
{
"name": "AppPortLBRule1",
"properties": {
"backendAddressPool": {
"id": "[variables('lbPoolID0')]"
},
"backendPort": "[variables('loadBalancedAppPort1')]",
"enableFloatingIP": false,
"frontendIPConfiguration": {
"id": "[variables('lbIPConfig0')]"
},
"frontendPort": "[variables('loadBalancedAppPort1')]",
"idleTimeoutInMinutes": 5,
"probe": {
"id": "[concat(variables('lbID0'), '/probes/AppPortProbe1')]"
},
"protocol": "Tcp"
}
},
{
"name": "AppPortLBRule2",
"properties": {
"backendAddressPool": {
"id": "[variables('lbPoolID0')]"
},
"backendPort": "[variables('loadBalancedAppPort2')]",
"enableFloatingIP": false,
"frontendIPConfiguration": {
"id": "[variables('lbIPConfig0')]"
},
"frontendPort": "[variables('loadBalancedAppPort2')]",
"idleTimeoutInMinutes": 5,
"probe": {
"id": "[concat(variables('lbID0'), '/probes/AppPortProbe2')]"
},
"protocol": "Tcp"
}
}
],
"probes": [
{
"name": "FabricGatewayProbe",
"properties": {
"intervalInSeconds": 5,
"numberOfProbes": 2,
"port": "[variables('fabricTcpGatewayPort')]",
"protocol": "Tcp"
}
},
{
"name": "FabricHttpGatewayProbe",
"properties": {
"intervalInSeconds": 5,
"numberOfProbes": 2,
"port": "[variables('fabricHttpGatewayPort')]",
"protocol": "Tcp"
}
},
{
"name": "AppPortProbe1",
"properties": {
"intervalInSeconds": 5,
"numberOfProbes": 2,
"port": "[variables('loadBalancedAppPort1')]",
"protocol": "Tcp"
}
},
{
"name": "AppPortProbe2",
"properties": {
"intervalInSeconds": 5,
"numberOfProbes": 2,
"port": "[variables('loadBalancedAppPort2')]",
"protocol": "Tcp"
}
}
],
"inboundNatPools": [
{
"name": "LoadBalancerBEAddressNatPool",
"properties": {
"backendPort": 3389,
"frontendIPConfiguration": {
"id": "[variables('lbIPConfig0')]"
},
"frontendPortRangeEnd": 4500,
"frontendPortRangeStart": 3389,
"protocol": "Tcp"
}
}
]
}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Compute/virtualMachineScaleSets",
"name": "[variables('vmNodeType0Name')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[variables('vmStorageAccountName')]",
"[variables('virtualNetworkName')]",
"[variables('supportLogStorageAccountName')]",
"[variables('applicationDiagnosticsStorageAccountName')]"
],
"tags": {
"resourceType": "Service Fabric",
"clusterName": "[variables('clusterName')]",
"displayName": "Cluster scale set"
},
"properties": {
"upgradePolicy": {
"mode": "Automatic"
},
"virtualMachineProfile": {
"extensionProfile": {
"extensions": [
{
"name": "[concat('ServiceFabricNodeVmExt', '_', variables('vmNodeType0Name'))]",
"properties": {
"type": "ServiceFabricNode",
"autoUpgradeMinorVersion": false,
"protectedSettings": {
"StorageAccountKey1": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('supportLogStorageAccountName')),'2015-06-15').key1]",
"StorageAccountKey2": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('supportLogStorageAccountName')),'2015-06-15').key2]"
},
"publisher": "Microsoft.Azure.ServiceFabric",
"settings": {
"clusterEndpoint": "[reference(variables('clusterName')).clusterEndpoint]",
"nodeTypeRef": "[variables('vmNodeType0Name')]",
"certificate": {
"thumbprint": "[parameters('certificateThumbprint')]",
"x509StoreName": "[variables('certificateStoreValue')]"
}
},
"typeHandlerVersion": "1.0"
}
},
{
"name": "[concat('VMDiagnosticsVmExt', '_', variables('vmNodeType0Name'))]",
"properties": {
"type": "IaaSDiagnostics",
"autoUpgradeMinorVersion": true,
"protectedSettings": {
"storageAccountName": "[variables('applicationDiagnosticsStorageAccountName')]",
"storageAccountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('applicationDiagnosticsStorageAccountName')),'2015-06-15').key1]",
"storageAccountEndPoint": "https://core.windows.net/"
},
"publisher": "Microsoft.Azure.Diagnostics",
"settings": {
"WadCfg": {
"DiagnosticMonitorConfiguration": {
"overallQuotaInMB": "50000",
"EtwProviders": {
"EtwEventSourceProviderConfiguration": [
{
"provider": "Microsoft-ServiceFabric-Actors",
"scheduledTransferKeywordFilter": "1",
"scheduledTransferPeriod": "PT5M",
"DefaultEvents": {
"eventDestination": "ServiceFabricReliableActorEventTable"
}
},
{
"provider": "Microsoft-ServiceFabric-Services",
"scheduledTransferPeriod": "PT5M",
"DefaultEvents": {
"eventDestination": "ServiceFabricReliableServiceEventTable"
}
}
],
"EtwManifestProviderConfiguration": [
{
"provider": "cbd93bc2-71e5-4566-b3a7-595d8eeca6e8",
"scheduledTransferLogLevelFilter": "Information",
"scheduledTransferKeywordFilter": "4611686018427387904",
"scheduledTransferPeriod": "PT5M",
"DefaultEvents": {
"eventDestination": "ServiceFabricSystemEventTable"
}
}
]
}
}
},
"StorageAccount": "[variables('applicationDiagnosticsStorageAccountName')]"
},
"typeHandlerVersion": "1.5"
}
}
]
},
"networkProfile": {
"networkInterfaceConfigurations": [
{
"name": "NIC-0",
"properties": {
"ipConfigurations": [
{
"name": "NIC-0-config",
"properties": {
"loadBalancerBackendAddressPools": [
{
"id": "[variables('lbPoolID0')]"
}
],
"loadBalancerInboundNatPools": [
{
"id": "[variables('lbNatPoolID0')]"
}
],
"subnet": {
"id": "[variables('subnet1Ref')]"
}
}
}
],
"primary": true
}
}
]
},
"osProfile": {
"adminPassword": "[parameters('adminPassword')]",
"adminUsername": "[parameters('adminUsername')]",
"computerNamePrefix": "[variables('vmNodeType0Name')]",
"secrets": [
{
"sourceVault": {
"id": "[parameters('sourceVaultResourceId')]"
},
"vaultCertificates": [
{
"certificateStore": "[variables('certificateStoreValue')]",
"certificateUrl": "[parameters('certificateUrlValue')]"
}
]
}
]
},
"storageProfile": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2012-R2-Datacenter",
"version": "latest"
},
"osDisk": {
"vhdContainers": [
"[concat('https://',variables('vmStorageAccountName'),'.blob.core.windows.net/vhds')]"
],
"name": "vmssosdisk",
"caching": "ReadOnly",
"createOption": "FromImage"
}
}
}
},
"sku": {
"name": "Standard_D1",
"capacity": 5,
"tier": "Standard"
}
},
{
"apiVersion": "2016-03-01",
"type": "Microsoft.ServiceFabric/clusters",
"name": "[variables('clusterName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[variables('supportLogStorageAccountName')]"
],
"tags": {
"resourceType": "Service Fabric",
"clusterName": "[variables('clusterName')]",
"displayName": "Cluster"
},
"properties": {
"certificate": {
"thumbprint": "[parameters('certificateThumbprint')]",
"x509StoreName": "[variables('certificateStoreValue')]"
},
"clientCertificateCommonNames": [ ],
"clientCertificateThumbprints": [ ],
"clusterState": "Default",
"diagnosticsStorageAccountConfig": {
"blobEndpoint": "[concat('https://', variables('supportLogStorageAccountName'), '.blob.core.windows.net/')]",
"protectedAccountKeyName": "StorageAccountKey1",
"queueEndpoint": "[concat('https://', variables('supportLogStorageAccountName'), '.queue.core.windows.net/')]",
"storageAccountName": "[variables('supportLogStorageAccountName')]",
"tableEndpoint": "[concat('https://', variables('supportLogStorageAccountName'), '.table.core.windows.net/')]"
},
"fabricSettings": [
{
"parameters": [
{
"name": "ClusterProtectionLevel",
"value": "EncryptAndSign"
}
],
"name": "Security"
}
],
"managementEndpoint": "[concat('https://', reference(variables('lbIPName')).dnsSettings.fqdn, ':', variables('fabricHttpGatewayPort'))]",
"nodeTypes": [
{
"name": "[variables('vmNodeType0Name')]",
"applicationPorts": {
"endPort": "30000",
"startPort": "20000"
},
"clientConnectionEndpointPort": "[variables('fabricTcpGatewayPort')]",
"ephemeralPorts": {
"endPort": "65534",
"startPort": "49152"
},
"httpGatewayEndpointPort": "[variables('fabricHttpGatewayPort')]",
"isPrimary": true,
"vmInstanceCount": 5
}
],
"provisioningState": "Default"
}
}
],
"outputs": {
"clusterProperties": {
"value": "[reference(variables('clusterName'))]",
"type": "object"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment