New-​Azure​Rm​Data​Factory​Encrypt​Value

Encrypts sensitive data.

Syntax

New-AzureRmDataFactoryEncryptValue
   [-DataFactory] <PSDataFactory>
   [[-Database] <String>]
   [[-Value] <SecureString>]
   [[-GatewayName] <String>]
   [[-Credential] <PSCredential>]
   [[-Type] <String>]
   [[-NonCredentialValue] <String>]
   [[-AuthenticationType] <String>]
   [[-Server] <String>]
   [<CommonParameters>]
New-AzureRmDataFactoryEncryptValue
   [-ResourceGroupName] <String>
   [[-Database] <String>]
   [-DataFactoryName] <String>
   [[-Value] <SecureString>]
   [[-GatewayName] <String>]
   [[-Credential] <PSCredential>]
   [[-Type] <String>]
   [[-NonCredentialValue] <String>]
   [[-AuthenticationType] <String>]
   [[-Server] <String>]
   [<CommonParameters>]

Description

The New-AzureRmDataFactoryEncryptValue cmdlet encrypts sensitive data, such as a password or a Microsoft SQL Server connection string, and returns an encrypted value.

Examples

Example 1: Encrypt a non-ODBC connection string

PS C:\>$Value = ConvertTo-SecureString 'Data Source=ContosoServer;Initial Catalog=catelog;user id =user123;password=password123' -AsPlainText -Force 
PS C:\> New-AzureRmDataFactoryEncryptValue -GatewayName "WikiGateway" -DataFactoryName "WikiAdf" -Value $value -ResourceGroupName "ADF" -Type OnPremisesSqlLinkedService

The first command uses the ConvertTo-SecureString cmdlet to convert the specified connection string to a SecureString object, and then stores that object in the $Value variable. For more information, type Get-Help ConvertTo-SecureString. Allowed values: SQL Server or Oracle connection string.

The second command creates an encrypted value for the object stored in $Value for the specified data factory, gateway, resource group, and linked service type.

Example 2: Encrypt a non-ODBC connection string that uses Windows authentication.

PS C:\>$Value = ConvertTo-SecureString 'Data Source=ContosoServer;Initial Catalog=catelog;Integrated Security=True' -AsPlainText -Force
PS C:\> $Credential = Get-Credential
PS C:\> New-AzureRmDataFactoryEncryptValue -DataFactoryName "WikiADF" -GatewayName "WikiGateway" -ResourceGroupName "ADF" -Value $Value -Credential $Credential -Type OnPremisesSqlLinkedService $Value = ConvertTo-SecureString 'Data Source=ContosoServer;Initial Catalog=catelog;Integrated Security=True' -AsPlainText -Force

The first command uses ConvertTo-SecureString to convert the specified connection string to a secure string object, and then stores that object in the $Value variable.

The second command uses the Get-Credential cmdlet to collect the windows authentication (user name and password), and then stores that PSCredential object in the $Credential variable. For more information, type Get-Help Get-Credential.

The third command creates an encrypted value for the object stored in $Value and $Credential for the specified data factory, gateway, resource group, and linked service type.

Example 3: Encrypt server name and credentials for File system linked service

PS C:\>$Value = ConvertTo-SecureString '\\servername' -AsPlainText -Force
PS C:\> $Credential = Get-Credential
PS C:\> New-AzureRmDataFactoryEncryptValue -DataFactoryName "WikiADF" -GatewayName "WikiGateway" -ResourceGroupName "ADF" -Value $Value -Credential $Credential -Type OnPremisesFileSystemLinkedService

The first command uses ConvertTo-SecureString to convert the specified string to a secure string, and then stores that object in the $Value variable.

The second command uses Get-Credential to collect the windows authentication (user name and password), and then stores that PSCredential object in the $Credential variable.

The third command creates an encrypted value for the object stored in $Value and $Credential for the specified data factory, gateway, resource group, and linked service type.

Example 4: Encrypt credentials for HDFS linked service

PS C:\>$UserName = ConvertTo-SecureString "domain\\username" -AsPlainText -Force
$Password = ConvertTo-SecureString "password" -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential ($UserName, $Password)
New-AzureRmDataFactoryEncryptValue -DataFactoryName "MyDataFactory" -ResourceGroupName "MyResourceGroup" -GatewayName "MyDataManagementGateway" -Type HdfsLinkedService -AuthenticationType Windows -Credential $Credential -NonCredentialValue "http://server01.com:50070/webhdfs/v1/user/username"

The ConvertTo-SecureString command converts the specified string to a secure string. The New-Object command creates a PSCredential object using the secure username and password strings. Instead, you could use the Get-Credential command to collect windows authentication (user name and password), and then store the returned PSCredential object in the $credential variable as shown in previous examples.

The New-AzureRmDataFactoryEncryptValue command creates an encrypted value for the object stored in $Credential for the specified data factory, gateway, resource group, and linked service type.

Example 5: Encrypt credentials for ODBC linked service

PS C:\>$Content = ConvertTo-SecureString "UID=username@contoso;PWD=password;" -AsPlainText -Force
New-AzureRmDataFactoryEncryptValue -ResourceGroupName $RGName -DataFactoryName $DFName -GatewayName $Gateway -Type OnPremisesOdbcLinkedService -AuthenticationType Basic -NonCredentialValue "Driver={SQL Server};Server=server01.database.contoso.net; Database=HDISScenarioTest;" -Value $content

The ConvertTo-SecureString command converts the specified string to a secure string.

The New-AzureRmDataFactoryEncryptValue command creates an encrypted value for the object stored in $Value for the specified data factory, gateway, resource group, and linked service type.

Required Parameters

-DataFactory

Specifies a PSDataFactory object. This cmdlet encrypts data for the data factory that this parameter specifies.

Type:PSDataFactory
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-DataFactoryName

Specifies the name of a data factory. This cmdlet encrypts data for the data factory that this parameter specifies.

Type:String
Position:2
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ResourceGroupName

Specifies the name of an Azure resource group. This cmdlet encrypts data for the group that this parameter specifies.

Type:String
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-AuthenticationType

Specifies the type of authentication to be used to connect to the data source. The acceptable values for this parameter are:- Windows

  • Basic
  • Anonymous.
Type:String
Position:8
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Credential

Specifies the Windows authentication credentials (user name and password) to be used. This cmdlet encrypts the credential data you specify here.

Type:PSCredential
Position:5
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Database

Specifies the database name of the linked service.

Type:String
Position:10
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-GatewayName

Specifies the name of the gateway. This cmdlet encrypts data for the gateway that this parameter specifies.

Type:String
Position:4
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-NonCredentialValue

Specifies the non-credential part of the Open Database Connectivity (ODBC) connection string. This parameter is applicable only for the ODBC linked service.

Type:String
Position:7
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Server

Specifies the server name of the linked service.

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

Specifies the linked service type. This cmdlet encrypts data for the linked service type that this parameter specifies. The acceptable values for this parameter are:- OnPremisesSqlLinkedService

  • OnPremisesFileSystemLinkedService
  • OnPremisesOracleLinkedService
  • OnPremisesOdbcLinkedService
  • OnPremisesPostgreSqlLinkedService
  • OnPremisesTeradataLinkedService
  • OnPremisesMySQLLinkedService
  • OnPremisesDB2LinkedService
  • OnPremisesSybaseLinkedService
Type:String
Position:6
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Value

Specifies the value to encrypt. For an on-premises SQL Server linked service and an on-premises Oracle linked service, use a connection string. For an on-premises ODBC linked service, use the credential part of the connection string. For on premises file system linked service, if the file system is local to the gateway computer, use Local or localhost, and if the file system is on a server different from the gateway computer, use \\servername.

Type:SecureString
Position:3
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Outputs

System.String

Notes

  • Keywords: azure, azurerm, arm, resource, management, manager, data, factories