你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

New-AzDataFactoryEncryptValue

加密敏感数据。

语法

ByFactoryName (默认值)

New-AzDataFactoryEncryptValue
    [-DataFactoryName] <String>
    [[-Value] <SecureString>]
    [-GatewayName] <String>
    [[-Credential] <PSCredential>]
    [[-Type] <String>]
    [[-NonCredentialValue] <String>]
    [[-AuthenticationType] <String>]
    [[-Server] <String>]
    [[-Database] <String>]
    [-ResourceGroupName] <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByFactoryObject

New-AzDataFactoryEncryptValue
    [-DataFactory] <PSDataFactory>
    [[-Value] <SecureString>]
    [-GatewayName] <String>
    [[-Credential] <PSCredential>]
    [[-Type] <String>]
    [[-NonCredentialValue] <String>]
    [[-AuthenticationType] <String>]
    [[-Server] <String>]
    [[-Database] <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

说明

New-AzDataFactoryEncryptValue cmdlet 加密敏感数据,例如密码或Microsoft SQL Server 连接字符串,并返回加密值。

示例

示例 1:加密非 ODBC 连接字符串

$Value = ConvertTo-SecureString 'Data Source=ContosoServer;Initial Catalog=catalog;user id =user123;password=******' -AsPlainText -Force
New-AzDataFactoryEncryptValue -GatewayName "WikiGateway" -DataFactoryName "WikiAdf" -Value $value -ResourceGroupName "ADF" -Type OnPremisesSqlLinkedService

第一个命令使用 ConvertTo-SecureString cmdlet 将指定的连接字符串转换为 SecureString 对象,然后将该对象存储在$Value变量中。 有关详细信息,请键入 Get-Help ConvertTo-SecureString。 允许的值:SQL Server 或 Oracle 连接字符串。 第二个命令为指定数据工厂、网关、资源组和链接服务类型$Value中存储的对象创建加密值。

示例 2:加密使用 Windows 身份验证的非 ODBC 连接字符串。

$Value = ConvertTo-SecureString -String 'Data Source=ContosoServer;Initial Catalog=catalog;Integrated Security=True' -AsPlainText -Force
$Credential = Get-Credential
New-AzDataFactoryEncryptValue -DataFactoryName "WikiADF" -GatewayName "WikiGateway" -ResourceGroupName "ADF" -Value $Value -Credential $Credential -Type OnPremisesSqlLinkedService

第一个命令使用 ConvertTo-SecureString 将指定的连接字符串转换为安全字符串对象,然后将该对象存储在$Value变量中。 第二个命令使用 Get-Credential cmdlet 收集 Windows 身份验证(用户名和密码),然后将该 PSCredential 对象存储在$Credential变量中。 有关详细信息,请键入 Get-Help Get-Credential。 第三个命令为存储在$Value中的对象创建加密值,并为指定的数据工厂、网关、资源组和链接服务类型创建$Credential。

示例 3:加密文件系统链接服务的服务器名称和凭据

$Value = ConvertTo-SecureString "******" -AsPlainText -Force
$Credential = Get-Credential
New-AzDataFactoryEncryptValue -DataFactoryName "WikiADF" -GatewayName "WikiGateway" -ResourceGroupName "ADF" -Value $Value -Credential $Credential -Type OnPremisesFileSystemLinkedService

第一个命令使用 ConvertTo-SecureString 将指定的字符串转换为安全字符串,然后将该对象存储在$Value变量中。 第二个命令使用 Get-Credential 收集 Windows 身份验证(用户名和密码),然后将 该 PSCredential 对象存储在$Credential变量中。 第三个命令为存储在$Value中的对象创建加密值,并为指定的数据工厂、网关、资源组和链接服务类型创建$Credential。

示例 4:加密 HDFS 链接服务的凭据

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

ConvertTo-SecureString 命令将指定的字符串转换为安全字符串。 New-Object 命令使用安全用户名和密码字符串创建 PSCredential 对象。 相反,可以使用 Get-Credential 命令收集 Windows 身份验证(用户名和密码),然后将返回的 PSCredential 对象存储在$credential变量中,如前面的示例所示。 New-AzDataFactoryEncryptValue 命令为指定的数据工厂、网关、资源组和链接服务类型创建存储在$Credential中的对象的加密值。

示例 5:加密 ODBC 链接服务的凭据

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

ConvertTo-SecureString 命令将指定的字符串转换为安全字符串。 New-AzDataFactoryEncryptValue 命令为指定的数据工厂、网关、资源组和链接服务类型$Value中存储的对象创建加密值。

参数

-AuthenticationType

指定要用于连接到数据源的身份验证类型。 此参数的可接受值为:

  • Windows操作系统
  • 基本
  • 匿名。

参数属性

类型:String
默认值:None
接受的值:Windows, Basic, Anonymous
支持通配符:False
不显示:False

参数集

(All)
Position:6
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Credential

指定要使用的 Windows 身份验证凭据(用户名和密码)。 此 cmdlet 将加密此处指定的凭据数据。

参数属性

类型:PSCredential
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:3
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Database

指定链接服务的数据库名称。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:8
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-DataFactory

指定 PSDataFactory 对象。 此 cmdlet 对此参数指定的数据工厂的数据进行加密。

参数属性

类型:PSDataFactory
默认值:None
支持通配符:False
不显示:False

参数集

ByFactoryObject
Position:0
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-DataFactoryName

指定数据工厂的名称。 此 cmdlet 对此参数指定的数据工厂的数据进行加密。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ByFactoryName
Position:1
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-DefaultProfile

用于与 azure 通信的凭据、帐户、租户和订阅

参数属性

类型:IAzureContextContainer
默认值:None
支持通配符:False
不显示:False
别名:AzContext, AzureRmContext, AzureCredential

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-GatewayName

指定网关的名称。 此 cmdlet 加密此参数指定的网关的数据。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:2
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-NonCredentialValue

指定 Open Database Connectivity (ODBC) 连接字符串的非凭据部分。 此参数仅适用于 ODBC 链接服务。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:5
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ResourceGroupName

指定 Azure 资源组的名称。 此 cmdlet 对此参数指定的组的数据进行加密。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ByFactoryName
Position:0
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-Server

指定链接服务的服务器名称。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:7
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Type

指定链接服务类型。 此 cmdlet 加密此参数指定的链接服务类型的数据。 此参数的可接受值为:

  • OnPremisesSqlLinkedService
  • OnPremisesFileSystemLinkedService
  • OnPremisesOracleLinkedService
  • OnPremisesOdbcLinkedService
  • OnPremisesPostgreSqlLinkedService
  • OnPremisesTeradataLinkedService
  • OnPremisesMySQLLinkedService
  • OnPremisesDB2LinkedService
  • OnPremisesSybaseLinkedService

参数属性

类型:String
默认值:None
接受的值:OnPremisesSqlLinkedService, OnPremisesFileSystemLinkedService, OnPremisesOracleLinkedService, OnPremisesOdbcLinkedService, OnPremisesPostgreSqlLinkedService, OnPremisesTeradataLinkedService, OnPremisesMySQLLinkedService, OnPremisesDB2LinkedService, OnPremisesSybaseLinkedService, HdfsLinkedService
支持通配符:False
不显示:False

参数集

(All)
Position:4
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Value

指定要加密的值。 对于本地 SQL Server 链接服务和本地 Oracle 链接服务,请使用连接字符串。 对于本地 ODBC 链接服务,请使用连接字符串的凭据部分。 对于本地文件系统链接服务,如果文件系统是网关计算机的本地,请使用 Local 或 localhost,如果文件系统位于不同于网关计算机的服务器上,请使用 \\servername。

参数属性

类型:SecureString
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:1
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters

输入

PSDataFactory

String

输出

String

备注

  • 关键字:azure, azurerm, arm, 资源, 管理, 经理, 数据, 工厂