Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Deploy a Service Fabric Cluster to Azure with .NET Framework 4.6

DZone's Guide to

Deploy a Service Fabric Cluster to Azure with .NET Framework 4.6

Here's how to get started running a Service Fabric Cluster to Microsoft Azure.

· Cloud Zone ·
Free Resource

Discover a centralized approach to monitor your virtual infrastructure, on-premise IT environment, and cloud infrastructure – all on a single platform.

For anyone working with Service Fabric and wishing to build a solution targeting the .NET Framework 4.6, deploying to Azure is a challenge given this version of the framework is not yet available in the default Windows Server 2012 image. 

To overcome the above limitation and to make the process as easy as possible, we'll employ a customised Azure Resource Manager (ARM) template which we'll first generate via the Azure Portal. 

To get started simply click here or search for Service Fabric Cluster in the Azure Marketplace.

As there is great guidance and content on Microsoft's Azure portal, I won't repeat the steps on Deploying a Service Fabric Cluster using an ARM template, but I will ask you to complete all the fields as you normally would (login, password, custom ports for http and https), but instead of pressing create and deploying your cluster, we'll opt to download the ARM template.

Opening the ARM template in Visual Code or your text editor of choice, search for the following JSON section:

"virtualMachineProfile": {
      "extensionProfile": {
         "extensions": [


Then add a custom script extension block with the following content:

{
   "name":"CustomScriptExtensionInstallNet46",
   "properties":{
      "publisher":"Microsoft.Compute",
      "type":"CustomScriptExtension",
      "typeHandlerVersion":"1.7",
      "autoUpgradeMinorVersion":false,
      "settings":{
         "fileUris":[
            "https://serviceprofiler.azurewebsites.net/content/downloads/InstallNetFx46.ps1"
         ],
         "commandToExecute":"powershell.exe -ExecutionPolicy Unrestricted -File InstallNetFx46.ps1"
      },
      "forceUpdateTag":"RerunExtension"
   }
},

Note, for additional security & flexibility self-host a copy of the InstallNetFx46.ps1 script file.


Download the ARM template — in my case I also rename the file to correspond to the environment targeted (for example AcmeServiceFabricUATCluster.json) and open a PowerShell window to the same folder. Then, issue the following commands, substituting the Acme values for your own:

Login-AzureRmAccount

Get-AzureRmSubscription –SubscriptionName "AcmeCorp" | Select-AzureRmSubscription

New-AzureRmResourceGroup -Name AcmeUAT -Location "West US"

New-AzureRmResourceGroupDeployment -Name AcmeUATDeployment -ResourceGroupName AcmeUAT -TemplateFile AcmeServiceFabricUATCluster.json

Enter the values requested such as password if executing interactively. Upon ARM completion, your Service Fabric nodes will now contain an installation of .NET Framework 4.6. How simple! The next step is to deploy your solution.

Learn how to auto-discover your containers and monitor their performance, capture Docker host and container metrics to allocate host resources, and provision containers.

Topics:
service fabric ,microservices ,azure ,microsoft ,devops

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}