Skip to content

Commit 915df17

Browse files
authored
Improve code formatting and usability of New-AzServiceFabricCluster examples (#11447)
* Fix markdown formatting errors * Descriptive variable names * Add changelog entry for code cleanup
1 parent 3c467f7 commit 915df17

File tree

2 files changed

+77
-41
lines changed

2 files changed

+77
-41
lines changed

src/ServiceFabric/ServiceFabric/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Improved code formatting and usability of New-AzServiceFabricCluster examples
2122

2223
## Version 2.0.1
2324
* Update references in .psd1 to use relative path

src/ServiceFabric/ServiceFabric/help/New-AzServiceFabricCluster.md

Lines changed: 76 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ schema: 2.0.0
88
# New-AzServiceFabricCluster
99

1010
## SYNOPSIS
11-
This command uses certificates that you provide or system generated self-signed certificates to set up a new service fabric cluster. It can use a default template or a custom template that you provide. You have the option of specifying a folder to export the self-signed certificates to or fetching them later from the key vault.
11+
12+
This command uses certificates that you provide or system generated self-signed certificates to set up a new service fabric cluster. It can use a default template or a custom template that you provide. You have the option of specifying a folder to export the self-signed certificates to or fetching them later from the key vault.
1213

1314
## SYNTAX
1415

1516
### ByDefaultArmTemplate (Default)
16-
```
17+
18+
```powershell
1719
New-AzServiceFabricCluster [-ResourceGroupName] <String> [-CertificateOutputFolder <String>]
1820
[-CertificatePassword <SecureString>] [-KeyVaultResourceGroupName <String>] [-KeyVaultName <String>]
1921
-Location <String> [-Name <String>] [-VmUserName <String>] [-ClusterSize <Int32>]
@@ -22,15 +24,17 @@ New-AzServiceFabricCluster [-ResourceGroupName] <String> [-CertificateOutputFold
2224
```
2325

2426
### ByExistingKeyVault
25-
```
27+
28+
```powershell
2629
New-AzServiceFabricCluster [-ResourceGroupName] <String> -TemplateFile <String> -ParameterFile <String>
2730
[-CertificateCommonName <String>] [-CertificateIssuerThumbprint <String>] [-VmPassword <SecureString>]
2831
-SecretIdentifier <String> [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
2932
[<CommonParameters>]
3033
```
3134

3235
### ByNewPfxAndVaultName
33-
```
36+
37+
```powershell
3438
New-AzServiceFabricCluster [-ResourceGroupName] <String> -TemplateFile <String> -ParameterFile <String>
3539
[-CertificateOutputFolder <String>] [-CertificatePassword <SecureString>]
3640
[-KeyVaultResourceGroupName <String>] [-KeyVaultName <String>] [-CertificateSubjectName <String>]
@@ -39,7 +43,8 @@ New-AzServiceFabricCluster [-ResourceGroupName] <String> -TemplateFile <String>
3943
```
4044

4145
### ByExistingPfxAndVaultName
42-
```
46+
47+
```powershell
4348
New-AzServiceFabricCluster [-ResourceGroupName] <String> -TemplateFile <String> -ParameterFile <String>
4449
-CertificateFile <String> [-CertificatePassword <SecureString>] [-SecondaryCertificateFile <String>]
4550
[-SecondaryCertificatePassword <SecureString>] [-KeyVaultResourceGroupName <String>] [-KeyVaultName <String>]
@@ -48,74 +53,80 @@ New-AzServiceFabricCluster [-ResourceGroupName] <String> -TemplateFile <String>
4853
```
4954

5055
## DESCRIPTION
56+
5157
The **New-AzServiceFabricCluster** command uses certificates that you provide or system generated self-signed certificates to set up a new service fabric cluster. The template used can be a default template or a custom template that you provide. You have the option of specifying a folder to export the self-signed certificates or fetching them later from the key vault.
5258
If you are specifying a custom template and parameter file, you don't need to provide the certificate information in the parameter file, the system will populate these parameters.
5359
The four options are detailed below. Scroll down for explanations of each of the parameters.
5460

5561
## EXAMPLES
5662

57-
### Example 1: Specify only the cluster size, the cert subject name, and the OS to deploy a cluster.
58-
```
59-
$pass="Password#1234" | ConvertTo-SecureString -AsPlainText -Force
60-
$RGname="test01"
61-
$clusterloc="SouthCentralUS"
62-
$subname="{0}.{1}.cloudapp.azure.com" -f $RGname, $clusterloc
63-
$pfxfolder="c:\certs"
63+
### Example 1: Specify only the cluster size, the cert subject name, and the OS to deploy a cluster
6464

65-
Write-Output "Create cluster in '$clusterloc' with cert subject name '$subname' and cert output path '$pfxfolder'"
65+
```powershell
66+
$password = "Password#1234" | ConvertTo-SecureString -AsPlainText -Force
67+
$resourceGroupName = "quickstart-sf-group"
68+
$azureRegion = "southcentralus"
69+
$clusterDnsName = "{0}.{1}.cloudapp.azure.com" -f $resourceGroupName, $azureRegion
70+
$localCertificateFolder = "c:\certs"
6671
67-
New-AzServiceFabricCluster -ResourceGroupName $RGname -Location $clusterloc -ClusterSize 5 -VmPassword $pass -CertificateSubjectName $subname -CertificateOutputFolder $pfxfolder -CertificatePassword $pass -OS WindowsServer2016Datacenter
72+
Write-Output "Create cluster in '$azureRegion' with cert subject name '$clusterDnsName' and cert output path '$localCertificateFolder'"
73+
74+
New-AzServiceFabricCluster -ResourceGroupName $resourceGroupName -Location $azureRegion -ClusterSize 5 -VmPassword $password -CertificateSubjectName $clusterDnsName -CertificateOutputFolder $localCertificateFolder -CertificatePassword $pass -OS WindowsServer2016Datacenter
6875
```
6976

7077
This command specifies only the cluster size, the cert subject name, and the OS to deploy a cluster.
7178

7279
### Example 2: Specify an existing Certificate resource in a key vault and a custom template to deploy a cluster
73-
```
74-
$RGname="test20"
75-
$templateParmfile="C:\service-fabric-secure-nsg-cluster-65-node-3-nodetype\azuredeploytest.parameters.json"
76-
$templateFile="C:\azure-quickstart-templates\service-fabric-secure-nsg-cluster-65-node-3-nodetype\azuredeploy.json"
77-
$secretId="https://test1.vault.azure.net:443/secrets/testcertificate4/56ec774dc61a462bbc645ffc9b4b225f"
7880

79-
New-AzServiceFabricCluster -ResourceGroupName $RGname -TemplateFile $templateFile -ParameterFile $templateParmfile -SecretIdentifier $secretId
81+
```powershell
82+
$resourceGroupName = "test20"
83+
$templateParameterFile = "C:\service-fabric-secure-nsg-cluster-65-node-3-nodetype\azuredeploytest.parameters.json"
84+
$templateFile = "C:\azure-quickstart-templates\service-fabric-secure-nsg-cluster-65-node-3-nodetype\azuredeploy.json"
85+
$secretId = "https://test1.vault.azure.net:443/secrets/testcertificate4/56ec774dc61a462bbc645ffc9b4b225f"
86+
87+
New-AzServiceFabricCluster -ResourceGroupName $resourceGroupName -TemplateFile $templateFile -ParameterFile $templateParameterFile -SecretIdentifier $secretId
8088
```
8189

8290
This command specifies an existing Certificate resource in a key vault and a custom template to deploy a cluster.
8391

8492
### Example 3: Create a new cluster using a custom template. Specify a different resource group name for the key vault and have the system upload a new certificate to it
85-
```
86-
$pass="Password#1234" | ConvertTo-SecureString -AsPlainText -Force
87-
$RGname="test20"
88-
$keyVaultRG="test20kvrg"
89-
$keyVault="test20kv"
90-
$clusterloc="SouthCentralUS"
91-
$subname="{0}.{1}.$clusterloc.cloudapp.azure.com" -f $RGName, $clusterloc
92-
$pfxfolder="~\Documents"
93-
$templateParmfile="C:\service-fabric-secure-nsg-cluster-65-node-3-nodetype\azuredeploytest.parameters.json"
94-
$templateFile="C:\service-fabric-secure-nsg-cluster-65-node-3-nodetype\azuredeploy.json"
9593

96-
New-AzServiceFabricCluster -ResourceGroupName $RGname -TemplateFile $templateFile -ParameterFile $templateParmfile -CertificateOutputFolder $pfxfolder -CertificatePassword $pass -KeyVaultResourceGroupName $keyVaultRG -KeyVaultName $keyVault -CertificateSubjectName $subname
94+
```powershell
95+
$password = "Password#1234" | ConvertTo-SecureString -AsPlainText -Force
96+
$resourceGroupName = "quickstart-sf-group"
97+
$keyVaultResourceGroupName = " quickstart-kv-group"
98+
$keyVaultName = "quickstart-kv"
99+
$azureRegion = "southcentralus"
100+
$clusterDnsName = "{0}.{1}.cloudapp.azure.com" -F $resourceGroupName, $azureRegion
101+
$localCertificateFolder = "~\Documents"
102+
$templateParameterFile = "C:\service-fabric-secure-nsg-cluster-65-node-3-nodetype\azuredeploytest.parameters.json"
103+
$templateFile = "C:\service-fabric-secure-nsg-cluster-65-node-3-nodetype\azuredeploy.json"
104+
105+
New-AzServiceFabricCluster -ResourceGroupName $resourceGroupName -TemplateFile $templateFile -ParameterFile $templateParameterFile -CertificateOutputFolder $localCertificateFolder -CertificatePassword $password -KeyVaultResourceGroupName $keyVaultResourceGroupName -KeyVaultName $keyVaultName -CertificateSubjectName $clusterDnsName
97106
```
98107

99108
This command creates a new cluster using a custom template. Specify a different resource group name for the key vault and have the system upload a new certificate to it
100109

101110
### Example 4: Bring your own Certificate and custom template and create a new cluster
102-
```
103-
$pass="Password#1234" | ConvertTo-SecureString -AsPlainText -Force
104-
$RGname="test20"
105-
$keyVaultRG="test20kvrg"
106-
$keyVault="test20kv"
107-
$pfxsourcefile="c:\Mycertificates\my2017Prodcert.pfx"
108-
$templateParmfile="~\Documents\GitHub\azure-quickstart-templates-parms\service-fabric-secure-nsg-cluster-65-node-3-nodetype\azuredeploytest.parameters.json"
109-
$templateFile="~\GitHub\azure-quickstart-templates\service-fabric-secure-nsg-cluster-65-node-3-nodetype\azuredeploy.json"
110111

111-
New-AzServiceFabricCluster -ResourceGroupName $RGname -TemplateFile $templateFile -ParameterFile $templateParmfile -CertificateFile $pfxsourcefile -CertificatePassword $pass -KeyVaultResourceGroupName $keyVaultRG -KeyVaultName $keyVault
112+
```powershell
113+
$password = "Password#1234" | ConvertTo-SecureString -AsPlainText -Force
114+
$resourceGroupName = "test20"
115+
$keyVaultResourceGroupName = "test20kvrg"
116+
$keyVaultName = "test20kv"
117+
$localCertificateFile = "c:\Mycertificates\my2017Prodcert.pfx"
118+
$templateParameterFile = "~\Documents\GitHub\azure-quickstart-templates-parms\service-fabric-secure-nsg-cluster-65-node-3-nodetype\azuredeploytest.parameters.json"
119+
$templateFile = "~\GitHub\azure-quickstart-templates\service-fabric-secure-nsg-cluster-65-node-3-nodetype\azuredeploy.json"
120+
121+
New-AzServiceFabricCluster -ResourceGroupName $resourceGroupName -TemplateFile $templateFile -ParameterFile $templateParameterFile -CertificateFile $localCertificateFile -CertificatePassword $password -KeyVaultResourceGroupName $keyVaultResourceGroupName -KeyVaultName $keyVaultName
112122
```
113123

114124
This command will let you bring your own Certificate and custom template and create a new cluster.
115125

116126
## PARAMETERS
117127

118128
### -CertificateCommonName
129+
119130
Certificate common name
120131

121132
```yaml
@@ -131,6 +142,7 @@ Accept wildcard characters: False
131142
```
132143
133144
### -CertificateFile
145+
134146
The existing certificate file path for the primary cluster certificate
135147
136148
```yaml
@@ -146,6 +158,7 @@ Accept wildcard characters: False
146158
```
147159
148160
### -CertificateIssuerThumbprint
161+
149162
Certificate issuer thumbprint, separated by commas if more than one
150163
151164
```yaml
@@ -161,6 +174,7 @@ Accept wildcard characters: False
161174
```
162175
163176
### -CertificateOutputFolder
177+
164178
The folder of the new certificate file to be created
165179
166180
```yaml
@@ -176,6 +190,7 @@ Accept wildcard characters: False
176190
```
177191
178192
### -CertificatePassword
193+
179194
The password of the certificate file
180195
181196
```yaml
@@ -191,6 +206,7 @@ Accept wildcard characters: False
191206
```
192207
193208
### -CertificateSubjectName
209+
194210
The subject name of the certificate to be created
195211
196212
```yaml
@@ -206,6 +222,7 @@ Accept wildcard characters: False
206222
```
207223
208224
### -ClusterSize
225+
209226
The number of nodes in the cluster.
210227
Default are 5 nodes
211228
@@ -222,6 +239,7 @@ Accept wildcard characters: False
222239
```
223240
224241
### -DefaultProfile
242+
225243
The credentials, account, tenant, and subscription used for communication with Azure.
226244
227245
```yaml
@@ -237,6 +255,7 @@ Accept wildcard characters: False
237255
```
238256
239257
### -KeyVaultName
258+
240259
Azure key vault name, if not given it will be defaulted to the resource group name
241260
242261
```yaml
@@ -252,6 +271,7 @@ Accept wildcard characters: False
252271
```
253272
254273
### -KeyVaultResourceGroupName
274+
255275
Azure key vault resource group name, if not given it will be defaulted to resource group name
256276
257277
```yaml
@@ -267,6 +287,7 @@ Accept wildcard characters: False
267287
```
268288
269289
### -Location
290+
270291
The resource group location
271292
272293
```yaml
@@ -282,6 +303,7 @@ Accept wildcard characters: False
282303
```
283304
284305
### -Name
306+
285307
Specify the name of the cluster, if not given it will be same as resource group name
286308
287309
```yaml
@@ -297,6 +319,7 @@ Accept wildcard characters: False
297319
```
298320
299321
### -OS
322+
300323
The Operating System of the VMs that make up the cluster.
301324
302325
```yaml
@@ -313,6 +336,7 @@ Accept wildcard characters: False
313336
```
314337
315338
### -ParameterFile
339+
316340
The path to the template parameter file.
317341
318342
```yaml
@@ -328,6 +352,7 @@ Accept wildcard characters: False
328352
```
329353
330354
### -ResourceGroupName
355+
331356
Specify the name of the resource group.
332357
333358
```yaml
@@ -343,6 +368,7 @@ Accept wildcard characters: False
343368
```
344369
345370
### -SecondaryCertificateFile
371+
346372
The existing certificate file path for the secondary cluster certificate
347373
348374
```yaml
@@ -358,6 +384,7 @@ Accept wildcard characters: False
358384
```
359385
360386
### -SecondaryCertificatePassword
387+
361388
The password of the certificate file
362389
363390
```yaml
@@ -373,6 +400,7 @@ Accept wildcard characters: False
373400
```
374401
375402
### -SecretIdentifier
403+
376404
The existing Azure key vault secret URL, for example 'https://mykv.vault.azure.net:443/secrets/mysecrets/55ec7c4dc61a462bbc645ffc9b4b225f'
377405
378406
```yaml
@@ -388,6 +416,7 @@ Accept wildcard characters: False
388416
```
389417
390418
### -TemplateFile
419+
391420
The path to the template file.
392421
393422
```yaml
@@ -403,6 +432,7 @@ Accept wildcard characters: False
403432
```
404433
405434
### -VmPassword
435+
406436
The password of the Vm.
407437
408438
```yaml
@@ -430,6 +460,7 @@ Accept wildcard characters: False
430460
```
431461
432462
### -VmSku
463+
433464
The Vm Sku
434465
435466
```yaml
@@ -445,6 +476,7 @@ Accept wildcard characters: False
445476
```
446477
447478
### -VmUserName
479+
448480
The user name for logging to Vm
449481
450482
```yaml
@@ -460,6 +492,7 @@ Accept wildcard characters: False
460492
```
461493
462494
### -Confirm
495+
463496
Prompts you for confirmation before running the cmdlet.
464497
465498
```yaml
@@ -475,6 +508,7 @@ Accept wildcard characters: False
475508
```
476509
477510
### -WhatIf
511+
478512
Shows what would happen if the cmdlet runs.
479513
The cmdlet is not run.
480514
@@ -491,7 +525,8 @@ Accept wildcard characters: False
491525
```
492526
493527
### CommonParameters
494-
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
528+
529+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
495530
496531
## INPUTS
497532

0 commit comments

Comments
 (0)