Over a million developers have joined DZone.

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

Build fast, scale big with MongoDB Atlas, a hosted service for the leading NoSQL database on AWS. Try it now! Brought to you in partnership with MongoDB.

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.

Now it's easier than ever to get started with MongoDB, the database that allows startups and enterprises alike to rapidly build planet-scale apps. Introducing MongoDB Atlas, the official hosted service for the database on AWS. Try it now! Brought to you in partnership with MongoDB.

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

Published at DZone with permission of Andrej Medic. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

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

{{ parent.tldr }}

{{ parent.urlSource.name }}