Invoke-​Service​Fabric​Encrypt​Text

Encrypts text to include in Service Fabric manifests or configurations.

Syntax

Invoke-ServiceFabricEncryptText
      [-Text] <String>
      [-AlgorithmOid <String>]
      [-CertFile]
      -Path <String>
      [-TimeoutSec <Int32>]
      [<CommonParameters>]
Invoke-ServiceFabricEncryptText
      [-Text] <String>
      [-AlgorithmOid <String>]
      [-CertStore]
      -CertThumbprint <String>
      [-StoreLocation <StoreLocation>]
      [-StoreName <String>]
      [-TimeoutSec <Int32>]
      [<CommonParameters>]

Description

The Invoke-ServiceFabricEncryptText cmdlet encrypts text to include in the Service Fabric cluster manifest, application manifest, or application configurations.

Note

The certificate used for encrypting text must have Data Encipherment as one of the Key Usage fields.

Before you perform any operation on a Service Fabric cluster, establish a connection to the cluster by using the Connect-ServiceFabricCluster cmdlet.

Examples

Example 1: Encrypt text with a Service Fabric manifest

$thumbprint="bf 7c 7a 9f 02 6c 60 62 c6 df 65 55 98 b7 44 e3 99 46 f7 27"
$encryptedText = Invoke-ServiceFabricEncryptText -Text "hello world" -CertThumbprint $thumbprint -CertStore -StoreLocation LocalMachine -StoreName My

Example 2:

$encryptedText = Invoke-ServiceFabricEncryptText -Text "hello world" -CertFile -Path c:\temp\mycert.cer

Required Parameters

-CertFile

Indicates that this cmdlet uses the CertFile option.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-CertStore

Indicates that this cmdlet uses the CertStore option.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-CertThumbprint

Specifies the thumbprint of a certificate.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Path

Specifies a path of a .cert or .pfx file.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Text

Specifies the text for the cmdlet.

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Optional Parameters

-AlgorithmOid

Specifies the object identifier of the algorithm for this cmdlet.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-StoreLocation

Specifies the location of a certificate store. Valid values are:- CurrentUser

  • LocalMachine
Type:StoreLocation
Parameter Sets:CurrentUser, LocalMachine
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-StoreName

Specifies the name of a certificate store.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TimeoutSec

Specifies the time-out period, in seconds, for the operation.

Type:Int32
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

You cannot pipe input to this cmdlet.

Outputs

System.Object

This cmdlet returns encrypted text as a string.