使用 Azure 数据工厂从 Dynamics AX 中复制数据Copy data from Dynamics AX by using Azure Data Factory
适用于:
Azure 数据工厂
Azure Synapse Analytics
本文概述了如何使用 Azure 数据工厂中的复制活动从 Dynamics AX 源复制数据。This article outlines how to use Copy Activity in Azure Data Factory to copy data from Dynamics AX source. 本文是根据总体概述复制活动的 Azure 数据工厂中的复制活动编写的。The article builds on Copy Activity in Azure Data Factory, which presents a general overview of Copy Activity.
支持的功能Supported capabilities
以下活动支持此 Dynamics AX 连接器:This Dynamics AX connector is supported for the following activities:
可以将数据从 Dynamics AX 复制到任何受支持的接收器数据存储。You can copy data from Dynamics AX to any supported sink data store. 有关复制活动支持作为源和接收器的数据存储的列表,请参阅支持的数据存储和格式。For a list of data stores that Copy Activity supports as sources and sinks, see Supported data stores and formats.
具体而言,此 Dynamics AX 连接器支持将 OData 协议与服务主体身份验证配合使用来从 Dynamics AX 中复制数据。Specifically, this Dynamics AX connector supports copying data from Dynamics AX using OData protocol with Service Principal authentication.
提示
还可以使用此连接器从 Dynamics 365 Finance and Operations 复制数据。You can also use this connector to copy data from Dynamics 365 Finance and Operations. 请参阅 Dynamics 365 的 OData 支持和身份验证方法。Refer to Dynamics 365's OData support and Authentication method.
入门Get started
若要使用管道执行复制活动,可以使用以下工具或 SDK 之一:To perform the Copy activity with a pipeline, you can use one of the following tools or SDKs:
- 复制数据工具The Copy Data tool
- Azure 门户The Azure portal
- .NET SDKThe .NET SDK
- Python SDKThe Python SDK
- Azure PowerShellAzure PowerShell
- REST APIThe REST API
- Azure 资源管理器模板The Azure Resource Manager template
对于特定于 Dynamics AX 连接器的数据工厂实体,以下部分提供了有关用于定义这些实体的属性的详细信息。The following sections provide details about properties you can use to define Data Factory entities that are specific to Dynamics AX connector.
先决条件Prerequisites
若要使用服务主体身份验证,请执行以下步骤:To use service principal authentication, follow these steps:
遵循将应用程序注册到 Azure AD 租户,在 Azure Active Directory (Azure AD) 中注册一个应用程序实体。Register an application entity in Azure Active Directory (Azure AD) by following Register your application with an Azure AD tenant. 记下下面的值,这些值用于定义链接服务:Make note of the following values, which you use to define the linked service:
- 应用程序 IDApplication ID
- 应用程序密钥Application key
- 租户 IDTenant ID
转到 Dynamics AX,向此服务主体授予用于访问 Dynamics AX 的正确权限。Go to Dynamics AX, and grant this service principal proper permission to access your Dynamics AX.
链接服务属性Linked service properties
Dynamics AX 链接的服务支持以下属性:The following properties are supported for Dynamics AX linked service:
propertiesProperty | 说明Description | 必选Required |
---|---|---|
typetype | type 属性必须设置为 DynamicsAX。The type property must be set to DynamicsAX. | 是Yes |
urlurl | Dynamics AX(或 Dynamics 365 Finance and Operations)实例 OData 终结点。The Dynamics AX (or Dynamics 365 Finance and Operations) instance OData endpoint. | 是Yes |
servicePrincipalIdservicePrincipalId | 指定应用程序的客户端 ID。Specify the application's client ID. | 是Yes |
servicePrincipalKeyservicePrincipalKey | 指定应用程序的密钥。Specify the application's key. 将此字段标记为 SecureString 以安全地将其存储在数据工厂中或引用存储在 Azure Key Vault 中的机密。Mark this field as a SecureString to store it securely in Data Factory, or reference a secret stored in Azure Key Vault. | 是Yes |
tenanttenant | 指定应用程序的租户信息(域名或租户 ID)。Specify the tenant information (domain name or tenant ID) under which your application resides. 将鼠标悬停在 Azure 门户右上角进行检索。Retrieve it by hovering the mouse in the top-right corner of the Azure portal. | 是Yes |
aadResourceIdaadResourceId | 指定你请求授权的 AAD 资源。Specify the AAD resource you are requesting for authorization. 例如,如果动态 URL 为 https://sampledynamics.sandbox.operations.dynamics.com/data/ ,则相应的 AAD 资源通常为 https://sampledynamics.sandbox.operations.dynamics.com 。For example, if your Dynamics URL is https://sampledynamics.sandbox.operations.dynamics.com/data/ , the corresponding AAD resource is usually https://sampledynamics.sandbox.operations.dynamics.com . |
是Yes |
connectViaconnectVia | 用于连接到数据存储的 Integration Runtime。The Integration Runtime to use to connect to the data store. 可选择 Azure Integration Runtime 或自承载集成运行时(如果数据存储位于专用网络)。You can choose Azure Integration Runtime or a self-hosted Integration Runtime (if your data store is located in a private network). 如果未指定,则使用默认 Azure Integration Runtime。If not specified, the default Azure Integration Runtime is used. | 否No |
示例Example
{
"name": "DynamicsAXLinkedService",
"properties": {
"type": "DynamicsAX",
"typeProperties": {
"url": "<Dynamics AX instance OData endpoint>",
"servicePrincipalId": "<service principal id>",
"servicePrincipalKey": {
"type": "SecureString",
"value": "<service principal key>"
},
"tenant": "<tenant info, e.g. microsoft.partner.onmschina.cn>",
"aadResourceId": "<AAD resource, e.g. https://sampledynamics.sandbox.operations.dynamics.com>"
}
},
"connectVia": {
"referenceName": "<name of Integration Runtime>",
"type": "IntegrationRuntimeReference"
}
}
数据集属性Dataset properties
本部分提供了 Dynamics AX 数据集支持的属性列表。This section provides a list of properties that the Dynamics AX dataset supports.
有关可用于定义数据集的各部分和属性的完整列表,请参阅数据集和链接服务。For a full list of sections and properties that are available for defining datasets, see Datasets and linked services.
要从 Dynamics AX 复制数据,请将数据集的 type 属性设置为 DynamicsAXResource。To copy data from Dynamics AX, set the type property of the dataset to DynamicsAXResource. 支持以下属性:The following properties are supported:
propertiesProperty | 说明Description | 必选Required |
---|---|---|
typetype | 数据集的 type 属性必须设置为 DynamicsAXResource。The type property of the dataset must be set to DynamicsAXResource. | 是Yes |
路径path | Dynamics AX OData 实体的路径。The path to the Dynamics AX OData entity. | 是Yes |
示例Example
{
"name": "DynamicsAXResourceDataset",
"properties": {
"type": "DynamicsAXResource",
"typeProperties": {
"path": "<entity path e.g. dd04tentitySet>"
},
"schema": [],
"linkedServiceName": {
"referenceName": "<Dynamics AX linked service name>",
"type": "LinkedServiceReference"
}
}
}
复制活动属性Copy Activity properties
本部分提供了 Dynamics AX 源支持的属性列表。This section provides a list of properties that the Dynamics AX source supports.
有关可用于定义活动的各个部分和属性的完整列表,请参阅管道。For a full list of sections and properties that are available for defining activities, see Pipelines.
作为源的 Dynamics AXDynamics AX as source
若要从 Dynamics AX 复制数据,请将复制活动中的 source 类型设置为 DynamicsAXSource。To copy data from Dynamics AX, set the source type in Copy Activity to DynamicsAXSource. 复制活动 source 节支持以下属性:The following properties are supported in the Copy Activity source section:
propertiesProperty | 说明Description | 必选Required |
---|---|---|
typetype | 复制活动源的 type 属性必须设置为 DynamicsAXSource。The type property of the Copy Activity source must be set to DynamicsAXSource. | 是Yes |
queryquery | 用于筛选数据的 OData 查询选项。OData query options for filtering data. 示例:"?$select=Name,Description&$top=5" 。Example: "?$select=Name,Description&$top=5" .注意:连接器会从以下组合 URL 复制数据: [URL specified in linked service]/[path specified in dataset][query specified in copy activity source] 。Note: The connector copies data from the combined URL: [URL specified in linked service]/[path specified in dataset][query specified in copy activity source] . 有关详细信息,请参阅 OData URL 组件。For more information, see OData URL components. |
否No |
httpRequestTimeouthttpRequestTimeout | 用于获取响应的 HTTP 请求的超时 (TimeSpan 值) 。The timeout (the TimeSpan value) for the HTTP request to get a response. 该值是获取响应而不是读取响应数据的超时。This value is the timeout to get a response, not the timeout to read response data. 如果未指定,默认值为 00:30:00(30 分钟)。If not specified, the default value is 00:30:00 (30 minutes). | 否No |
示例Example
"activities":[
{
"name": "CopyFromDynamicsAX",
"type": "Copy",
"inputs": [
{
"referenceName": "<Dynamics AX input dataset name>",
"type": "DatasetReference"
}
],
"outputs": [
{
"referenceName": "<output dataset name>",
"type": "DatasetReference"
}
],
"typeProperties": {
"source": {
"type": "DynamicsAXSource",
"query": "$top=10"
},
"sink": {
"type": "<sink type>"
}
}
}
]
“查找”活动属性Lookup activity properties
若要了解有关属性的详细信息,请查看 Lookup 活动。To learn details about the properties, check Lookup activity.
后续步骤Next steps
有关 Azure 数据工厂中复制活动支持用作源和接收器的数据存储的列表,请参阅支持的数据存储和格式。For a list of data stores that Copy Activity supports as sources and sinks in Azure Data Factory, see Supported data stores and formats.