|
| 1 | +--- |
| 2 | +title: Create a Service Fabric cluster using Azure Resource Manager template |
| 3 | +description: In this quickstart, you will create an Azure Service Fabric test cluster by using Azure Resource Manager template. |
| 4 | +author: erikadoyle |
| 5 | +ms.service: service-fabric |
| 6 | +ms.topic: quickstart |
| 7 | +ms.custom: subject-armqs |
| 8 | +ms.author: edoyle |
| 9 | +ms.date: 04/24/2020 |
| 10 | +--- |
| 11 | +# Quickstart: Create a Service Fabric cluster using Resource Manager template |
| 12 | + |
| 13 | +Azure Service Fabric is a distributed systems platform that makes it easy to package, deploy, and manage scalable and reliable microservices and containers. A Service Fabric *cluster* is a network-connected set of virtual machines into which your microservices are deployed and managed. |
| 14 | + |
| 15 | +[!INCLUDE [About Azure Resource Manager](../../includes/resource-manager-quickstart-introduction.md)] |
| 16 | + |
| 17 | +This article describes how to deploy a Service Fabric test cluster in Azure using the Resource Manager. This five-node Windows cluster is secured with a self-signed certificate and thus only intended for instructional purposes (rather than production workloads). |
| 18 | + |
| 19 | +We'll use Azure PowerShell to deploy the template. In addition to Azure PowerShell, you can also use the Azure portal, Azure CLI, and REST API. To learn other deployment methods, see [Deploy templates](../azure-resource-manager/templates/deploy-portal.md). |
| 20 | + |
| 21 | +If you don't have an Azure subscription, create a [free](https://azure.microsoft.com/free/) account before you begin. |
| 22 | + |
| 23 | +## Prerequisites |
| 24 | + |
| 25 | +### Install Service Fabric SDK and PowerShell modules |
| 26 | + |
| 27 | +To complete this quickstart, you'll need to: |
| 28 | + |
| 29 | +* Install the [Service Fabric SDK and PowerShell module](service-fabric-get-started.md). |
| 30 | + |
| 31 | +* Install [Azure PowerShell](https://docs.microsoft.com/powershell/azure/install-Az-ps). |
| 32 | + |
| 33 | +### Download the sample template and certificate helper script |
| 34 | + |
| 35 | +Clone or download the [Azure Resource Manager quickstart Templates](https://github.com/Azure/azure-quickstart-templates) repo. Alternatively, copy down locally the following files we'll be using from the *service-fabric-secure-cluster-5-node-1-nodetype* folder: |
| 36 | + |
| 37 | +* [New-ServiceFabricClusterCertificate.ps1](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/service-fabric-secure-cluster-5-node-1-nodetype/New-ServiceFabricClusterCertificate.ps1) |
| 38 | +* [azuredeploy.json](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/service-fabric-secure-cluster-5-node-1-nodetype/azuredeploy.json) |
| 39 | +* [azuredeploy.parameters.json](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/service-fabric-secure-cluster-5-node-1-nodetype/azuredeploy.parameters.json) |
| 40 | + |
| 41 | +### Sign in to Azure |
| 42 | + |
| 43 | +Sign in to Azure and designate the subscription to use for creating your Service Fabric cluster. |
| 44 | + |
| 45 | +```powershell |
| 46 | +# Sign in to your Azure account |
| 47 | +Login-AzAccount -SubscriptionId "<subscription ID>" |
| 48 | +``` |
| 49 | + |
| 50 | +### Create a self-signed certificate stored in Key Vault |
| 51 | + |
| 52 | +Service Fabric uses X.509 certificates to [secure a cluster](./service-fabric-cluster-security.md) and provide application security features, and [Key Vault](../key-vault/general/overview.md) to manage those certificates. Successful cluster creation requires a cluster certificate to enable node-to-node communication. For the purpose of creating this quickstart test cluster, we'll create a self-signed certificate for cluster authentication. Production workloads require certificates created using a correctly configured Windows Server certificate service or one from an approved certificate authority (CA). |
| 53 | + |
| 54 | +```powershell |
| 55 | +# Designate unique (within cloudapp.azure.com) names for your resources |
| 56 | +$resourceGroupName = "SFQuickstartRG" |
| 57 | +$keyVaultName = "SFQuickstartKV" |
| 58 | +
|
| 59 | +# Create a new resource group for your Key Vault and Service Fabric cluster |
| 60 | +New-AzResourceGroup -Name $resourceGroupName -Location SouthCentralUS |
| 61 | +
|
| 62 | +# Create a Key Vault enabled for deployment |
| 63 | +New-AzKeyVault -VaultName $KeyVaultName -ResourceGroupName $resourceGroupName -Location SouthCentralUS -EnabledForDeployment |
| 64 | +
|
| 65 | +# Generate a certificate and upload it to Key Vault |
| 66 | +.\New-ServiceFabricClusterCertificate.ps1 |
| 67 | +``` |
| 68 | + |
| 69 | +The script will prompt you for the following (be sure to modify *CertDNSName* and *KeyVaultName* from the example values below): |
| 70 | + |
| 71 | +* **Password:** Password!1 |
| 72 | +* **CertDNSName:** *sfquickstart*.southcentralus.cloudapp.azure.com |
| 73 | +* **KeyVaultName:** *SFQuickstartKV* |
| 74 | +* **KeyVaultSecretName:** clustercert |
| 75 | + |
| 76 | +Upon completion, the script will provide the parameter values needed for template deployment. Be sure to store these in the following variables, as they will be needed to deploy your cluster template: |
| 77 | + |
| 78 | +```powershell |
| 79 | +$sourceVaultId = "<Source Vault Resource Id>" |
| 80 | +$certUrlValue = "<Certificate URL>" |
| 81 | +$certThumbprint = "<Certificate Thumbprint>" |
| 82 | +``` |
| 83 | + |
| 84 | +## Create a Service Fabric cluster |
| 85 | + |
| 86 | +### Review the template |
| 87 | + |
| 88 | +The template used in this quickstart is from [Azure quickstart templates](https://github.com/Azure/azure-quickstart-templates/blob/master/service-fabric-secure-cluster-5-node-1-nodetype). The template for this article is too long to show here. To view the template, see https://github.com/Azure/azure-quickstart-templates/blob/master/service-fabric-secure-cluster-5-node-1-nodetype/azuredeploy.json. |
| 89 | + |
| 90 | +Multiple Azure resources have been defined in the template: |
| 91 | + |
| 92 | +* [Microsoft.Storage/storageAccounts](/azure/templates/microsoft.storage/storageaccounts) |
| 93 | +* [Microsoft.Network/virtualNetworks](/azure/templates/microsoft.network/virtualnetworks) |
| 94 | +* [Microsoft.Network/publicIPAddresses](/azure/templates/microsoft.network/publicipaddresses) |
| 95 | +* [Microsoft.Network/loadBalancers](/azure/templates/microsoft.network/loadbalancers) |
| 96 | +* [Microsoft.Compute/virtualMachineScaleSets](/azure/templates/microsoft.compute/virtualmachinescalesets) |
| 97 | +* [Microsoft.ServiceFabric/clusters](/azure/templates/microsoft.servicefabric/clusters) |
| 98 | + |
| 99 | +To find more templates that are related to Azure Service Fabric, see |
| 100 | +[Azure quickstart Templates](https://azure.microsoft.com/resources/templates/?sort=Popular&term=service+fabric). |
| 101 | + |
| 102 | +### Customize the parameters file |
| 103 | + |
| 104 | +Open *azuredeploy.parameters.json* and edit the parameter values so that: |
| 105 | + |
| 106 | +* **clusterName** matches the value you supplied for *CertDNSName* when creating your cluster certificate |
| 107 | +* **adminUserName** is some value other than the default *GEN-UNIQUE* token |
| 108 | +* **adminPassword** is some value other than the default *GEN-PASSWORD* token |
| 109 | +* **certificateThumbprint**, **sourceVaultResourceId**, and **certificateUrlValue** are all empty string (`""`) |
| 110 | + |
| 111 | +For example: |
| 112 | + |
| 113 | +```json |
| 114 | +{ |
| 115 | + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", |
| 116 | + "contentVersion": "1.0.0.0", |
| 117 | + "parameters": { |
| 118 | + "clusterName": { |
| 119 | + "value": "sfquickstart" |
| 120 | + }, |
| 121 | + "adminUsername": { |
| 122 | + "value": "testadm" |
| 123 | + }, |
| 124 | + "adminPassword": { |
| 125 | + "value": "Password#1234" |
| 126 | + }, |
| 127 | + "certificateThumbprint": { |
| 128 | + "value": "" |
| 129 | + }, |
| 130 | + "sourceVaultResourceId": { |
| 131 | + "value": "" |
| 132 | + }, |
| 133 | + "certificateUrlValue": { |
| 134 | + "value": "" |
| 135 | + } |
| 136 | + } |
| 137 | +} |
| 138 | +``` |
| 139 | + |
| 140 | +## Deploy the template |
| 141 | + |
| 142 | +Store the paths of your Resource Manager template and parameter files in variables, then deploy the template. |
| 143 | + |
| 144 | +```powershell |
| 145 | +$templateFilePath = "<full path to azuredeploy.json>" |
| 146 | +$parameterFilePath = "<full path to azuredeploy.parameters.json>" |
| 147 | +
|
| 148 | +New-AzResourceGroupDeployment ` |
| 149 | + -ResourceGroupName $resourceGroupName ` |
| 150 | + -TemplateFile $templateFilePath ` |
| 151 | + -TemplateParameterFile $parameterFilePath ` |
| 152 | + -CertificateThumbprint $certThumbprint ` |
| 153 | + -CertificateUrlValue $certUrlValue ` |
| 154 | + -SourceVaultResourceId $sourceVaultId ` |
| 155 | + -Verbose |
| 156 | +``` |
| 157 | + |
| 158 | +## Review deployed resources |
| 159 | + |
| 160 | +Once the deployment completes, find the `managementEndpoint` value in the output and open the address in a web browser to view your cluster in [Service Fabric Explorer](./service-fabric-visualizing-your-cluster.md). |
| 161 | + |
| 162 | + |
| 163 | + |
| 164 | +You can also find the Service Fabric Explorer endpoint from your Service Explorer resource blade in Azure portal. |
| 165 | + |
| 166 | + |
| 167 | + |
| 168 | +## Clean up resources |
| 169 | + |
| 170 | +When no longer needed, delete the resource group, which deletes the resources in the resource group. |
| 171 | + |
| 172 | +```powershell |
| 173 | +$resourceGroupName = Read-Host -Prompt "Enter the Resource Group name" |
| 174 | +Remove-AzResourceGroup -Name $resourceGroupName |
| 175 | +Write-Host "Press [ENTER] to continue..." |
| 176 | +``` |
| 177 | + |
| 178 | +## Next steps |
| 179 | + |
| 180 | +To learn about creating a custom Azure Service Fabric cluster template, see: |
| 181 | + |
| 182 | +> [!div class="nextstepaction"] |
| 183 | +> [Create a Service Fabric cluster Resource Manager template](service-fabric-cluster-creation-create-template.md) |
0 commit comments