使用 Azure 数据工厂从 Salesforce Marketing Cloud 复制数据Copy data from Salesforce Marketing Cloud using Azure Data Factory

适用于:是 Azure 数据工厂是 Azure Synapse Analytics(预览版)APPLIES TO: yesAzure Data Factory yesAzure Synapse Analytics (Preview)

本文概述了如何使用 Azure 数据工厂中的复制活动从 Salesforce Marketing Cloud 复制数据。This article outlines how to use the Copy Activity in Azure Data Factory to copy data from Salesforce Marketing Cloud. 它是基于概述复制活动总体的复制活动概述一文。It builds on the copy activity overview article that presents a general overview of copy activity.

支持的功能Supported capabilities

以下活动支持此 Salesforce Marketing Cloud 连接器:This Salesforce Marketing Cloud connector is supported for the following activities:

可以将数据从 Salesforce Marketing Cloud 复制到任何支持的接收器数据存储。You can copy data from Salesforce Marketing Cloud to any supported sink data store. 有关复制活动支持作为源/接收器的数据存储列表,请参阅支持的数据存储表。For a list of data stores that are supported as sources/sinks by the copy activity, see the Supported data stores table.

Salesforce Marketing Cloud 连接器支持 OAuth 2 身份验证,并同时支持旧包类型和增强包类型。The Salesforce Marketing Cloud connector supports OAuth 2 authentication, and it supports both legacy and enhanced package types. 该连接器在 Salesforce Marketing Cloud REST API 的基础上构建。The connector is built on top of the Salesforce Marketing Cloud REST API.

备注

此连接器不支持检索自定义对象或自定义数据扩展。This connector doesn't support retrieving custom objects or custom data extensions.

入门Getting started

可以使用 .NET SDK、Python SDK、Azure PowerShell、REST API 或 Azure 资源管理器模板创建包含复制活动的管道。You can create a pipeline with copy activity using .NET SDK, Python SDK, Azure PowerShell, REST API, or Azure Resource Manager template. 有关创建包含复制活动的管道的分步说明,请参阅复制活动教程See Copy activity tutorial for step-by-step instructions to create a pipeline with a copy activity.

对于特定于 Salesforce Marketing Cloud 连接器的数据工厂实体,以下部分提供有关用于定义这些实体的属性的详细信息。The following sections provide details about properties that are used to define Data Factory entities specific to Salesforce Marketing Cloud connector.

链接服务属性Linked service properties

Salesforce Marketing Cloud 链接的服务支持以下属性:The following properties are supported for Salesforce Marketing Cloud linked service:

属性Property 说明Description 必须Required
typetype type 属性必须设置为:SalesforceMarketingCloudThe type property must be set to: SalesforceMarketingCloud Yes
connectionPropertiesconnectionProperties 一组属性,定义如何连接到 Salesforce Marketing Cloud。A group of properties that defines how to connect to Salesforce Marketing Cloud. Yes
connectionProperties 下:Under connectionProperties:
authenticationTypeauthenticationType 指定要使用的身份验证方法。Specifies the authentication method to use. 允许的值为 Enhanced sts OAuth 2.0OAuth_2.0Allowed values are Enhanced sts OAuth 2.0 or OAuth_2.0.

Salesforce Marketing Cloud 旧包仅支持 OAuth_2.0,而增强包需要 Enhanced sts OAuth 2.0Salesforce Marketing Cloud legacy package only supports OAuth_2.0, while enhanced package needs Enhanced sts OAuth 2.0.
自 2019 年 8 月 1 日起,Salesforce Marketing Cloud 去除了创建旧包的功能。Since August 1, 2019, Salesforce Marketing Cloud has removed the ability to create legacy packages. 所有新包都是增强包。All new packages are enhanced packages.
Yes
hosthost 对于增强包,主机应为子域,由以字母“mc”开头的 28 个字符的字符串表示,例如 mc563885gzs27c5t9-63k636ttgmFor enhanced package, the host should be your subdomain which is represented by a 28-character string starting with the letters "mc", e.g. mc563885gzs27c5t9-63k636ttgm.
对于旧包,指定 www.exacttargetapis.comFor legacy package, specify www.exacttargetapis.com.
Yes
clientIdclientId 与 Salesforce Marketing Cloud 应用程序关联的客户端 ID。The client ID associated with the Salesforce Marketing Cloud application. Yes
clientSecretclientSecret 与 Salesforce Marketing Cloud 应用程序关联的客户端密码。The client secret associated with the Salesforce Marketing Cloud application. 可选择将此字段标记为 SecureString,将其安全地存储在 ADF 中,或在 Azure Key Vault 中存储机密,并允许 ADF 复制活动在执行数据复制时从此处拉取(请参阅在 Key Vault 中存储凭据了解详细信息)。You can choose to mark this field as a SecureString to store it securely in ADF, or store the secret in Azure Key Vault and let ADF copy activity pull from there when performing data copy - learn more from Store credentials in Key Vault. Yes
useEncryptedEndpointsuseEncryptedEndpoints 指定是否使用 HTTPS 加密数据源终结点。Specifies whether the data source endpoints are encrypted using HTTPS. 默认值为 true。The default value is true. No
useHostVerificationuseHostVerification 指定通过 TLS 进行连接时是否要求服务器证书中的主机名与服务器的主机名匹配。Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over TLS. 默认值为 true。The default value is true. No
usePeerVerificationusePeerVerification 指定通过 TLS 进行连接时是否要验证服务器的标识。Specifies whether to verify the identity of the server when connecting over TLS. 默认值为 true。The default value is true. No

示例:对增强包使用增强版 STS OAuth 2 身份验证Example: using enhanced STS OAuth 2 authentication for enhanced package

{
    "name": "SalesforceMarketingCloudLinkedService",
    "properties": {
        "type": "SalesforceMarketingCloud",
        "typeProperties": {
            "connectionProperties": {
                "host": "<subdomain e.g. mc563885gzs27c5t9-63k636ttgm>",
                "authenticationType": "Enhanced sts OAuth 2.0",
                "clientId": "<clientId>",
                "clientSecret": {
                     "type": "SecureString",
                     "value": "<clientSecret>"
                },
                "useEncryptedEndpoints": true,
                "useHostVerification": true,
                "usePeerVerification": true
            }
        }
    }
}

示例:对旧包使用 OAuth 2 身份验证Example: using OAuth 2 authentication for legacy package

{
    "name": "SalesforceMarketingCloudLinkedService",
    "properties": {
        "type": "SalesforceMarketingCloud",
        "typeProperties": {
            "connectionProperties": {
                "host": "www.exacttargetapis.com",
                "authenticationType": "OAuth_2.0",
                "clientId": "<clientId>",
                "clientSecret": {
                     "type": "SecureString",
                     "value": "<clientSecret>"
                },
                "useEncryptedEndpoints": true,
                "useHostVerification": true,
                "usePeerVerification": true
            }
        }
    }
}

如果使用的是具有以下有效负载的 Salesforce Marketing Cloud 链接服务,它仍然按原样受支持,但建议使用新的版本来添加增强包支持。If you were using Salesforce Marketing Cloud linked service with the following payload, it is still supported as-is, while you are suggested to use the new one going forward which adds enhanced package support.

{
    "name": "SalesforceMarketingCloudLinkedService",
    "properties": {
        "type": "SalesforceMarketingCloud",
        "typeProperties": {
            "clientId": "<clientId>",
            "clientSecret": {
                 "type": "SecureString",
                 "value": "<clientSecret>"
            },
            "useEncryptedEndpoints": true,
            "useHostVerification": true,
            "usePeerVerification": true
        }
    }
}

数据集属性Dataset properties

有关可用于定义数据集的各部分和属性的完整列表,请参阅数据集一文。For a full list of sections and properties available for defining datasets, see the datasets article. 本部分提供 Salesforce Marketing Cloud 数据集支持的属性列表。This section provides a list of properties supported by Salesforce Marketing Cloud dataset.

要从 Salesforce Marketing Cloud 复制数据,请将数据集的 type 属性设置为 SalesforceMarketingCloudObject 。To copy data from Salesforce Marketing Cloud, set the type property of the dataset to SalesforceMarketingCloudObject. 支持以下属性:The following properties are supported:

属性Property 描述Description 必须Required
typetype 数据集的 type 属性必须设置为:SalesforceMarketingCloudObjectThe type property of the dataset must be set to: SalesforceMarketingCloudObject Yes
tableNametableName 表的名称。Name of the table. 否(如果指定了活动源中的“query”)No (if "query" in activity source is specified)

示例Example

{
    "name": "SalesforceMarketingCloudDataset",
    "properties": {
        "type": "SalesforceMarketingCloudObject",
        "typeProperties": {},
        "schema": [],
        "linkedServiceName": {
            "referenceName": "<SalesforceMarketingCloud linked service name>",
            "type": "LinkedServiceReference"
        }
    }
}

复制活动属性Copy activity properties

有关可用于定义活动的各部分和属性的完整列表,请参阅管道一文。For a full list of sections and properties available for defining activities, see the Pipelines article. 本部分提供 Salesforce Marketing Cloud 源支持的属性列表。This section provides a list of properties supported by Salesforce Marketing Cloud source.

Salesforce Marketing Cloud 作为源Salesforce Marketing Cloud as source

要从 Salesforce Marketing Cloud 复制数据,请将复制活动中的源类型设置为 SalesforceMarketingCloudSource 。To copy data from Salesforce Marketing Cloud, set the source type in the copy activity to SalesforceMarketingCloudSource. 复制活动source部分支持以下属性:The following properties are supported in the copy activity source section:

属性Property 描述Description 必须Required
typetype 复制活动 source 的 type 属性必须设置为:SalesforceMarketingCloudSourceThe type property of the copy activity source must be set to: SalesforceMarketingCloudSource Yes
queryquery 使用自定义 SQL 查询读取数据。Use the custom SQL query to read data. 例如:"SELECT * FROM MyTable"For example: "SELECT * FROM MyTable". 否(如果指定了数据集中的“tableName”)No (if "tableName" in dataset is specified)

示例:Example:

"activities":[
    {
        "name": "CopyFromSalesforceMarketingCloud",
        "type": "Copy",
        "inputs": [
            {
                "referenceName": "<SalesforceMarketingCloud input dataset name>",
                "type": "DatasetReference"
            }
        ],
        "outputs": [
            {
                "referenceName": "<output dataset name>",
                "type": "DatasetReference"
            }
        ],
        "typeProperties": {
            "source": {
                "type": "SalesforceMarketingCloudSource",
                "query": "SELECT * FROM MyTable"
            },
            "sink": {
                "type": "<sink type>"
            }
        }
    }
]

Lookup 活动属性Lookup activity properties

若要了解有关属性的详细信息,请查看 Lookup 活动To learn details about the properties, check Lookup activity.

后续步骤Next steps

有关 Azure 数据工厂中复制活动支持作为源和接收器的数据存储的列表,请参阅支持的数据存储For a list of data stores supported as sources and sinks by the copy activity in Azure Data Factory, see supported data stores.