|
| 1 | +--- |
| 2 | +title: Copy data in Microsoft Fabric Lakehouse Table (Preview) |
| 3 | +titleSuffix: Azure Data Factory & Azure Synapse |
| 4 | +description: Learn how to copy data to and from Microsoft Fabric Lakehouse Table (Preview) using Azure Data Factory or Azure Synapse Analytics pipelines. |
| 5 | +ms.author: jianleishen |
| 6 | +author: jianleishen |
| 7 | +ms.service: data-factory |
| 8 | +ms.subservice: data-movement |
| 9 | +ms.topic: conceptual |
| 10 | +ms.custom: synapse |
| 11 | +ms.date: 09/28/2023 |
| 12 | +--- |
| 13 | + |
| 14 | +# Copy data in Microsoft Fabric Lakehouse Table (Preview) using Azure Data Factory or Azure Synapse Analytics |
| 15 | + |
| 16 | +[!INCLUDE[appliesto-adf-asa-md](includes/appliesto-adf-asa-md.md)] |
| 17 | + |
| 18 | +This article outlines how to use Copy Activity to copy data from and to Microsoft Fabric Lakehouse Table (Preview). To learn more, read the introductory article for [Azure Data Factory](introduction.md) or [Azure Synapse Analytics](../synapse-analytics/overview-what-is.md). |
| 19 | + |
| 20 | +> [!IMPORTANT] |
| 21 | +> This connector is currently in preview. You can try it out and give us feedback. If you want to take a dependency on preview connectors in your solution, please contact [Azure support](https://azure.microsoft.com/support/). |
| 22 | +
|
| 23 | +## Supported capabilities |
| 24 | + |
| 25 | +This Microsoft Fabric Lakehouse Table connector is supported for the following capabilities: |
| 26 | + |
| 27 | +| Supported capabilities|IR | Managed private endpoint| |
| 28 | +|---------| --------| --------| |
| 29 | +|[Copy activity](copy-activity-overview.md) (source/sink)|① ②|✓ | |
| 30 | + |
| 31 | +<small>*① Azure integration runtime ② Self-hosted integration runtime*</small> |
| 32 | + |
| 33 | +## Get started |
| 34 | + |
| 35 | +[!INCLUDE [data-factory-v2-connector-get-started](includes/data-factory-v2-connector-get-started.md)] |
| 36 | + |
| 37 | +## Create a Microsoft Fabric Lakehouse linked service using UI |
| 38 | + |
| 39 | +Use the following steps to create a Microsoft Fabric Lakehouse linked service in the Azure portal UI. |
| 40 | + |
| 41 | +1. Browse to the Manage tab in your Azure Data Factory or Synapse workspace and select Linked Services, then select New: |
| 42 | + |
| 43 | + # [Azure Data Factory](#tab/data-factory) |
| 44 | + |
| 45 | + :::image type="content" source="media/doc-common-process/new-linked-service.png" alt-text="Screenshot of creating a new linked service with Azure Data Factory UI."::: |
| 46 | + |
| 47 | + # [Azure Synapse](#tab/synapse-analytics) |
| 48 | + |
| 49 | + :::image type="content" source="media/doc-common-process/new-linked-service-synapse.png" alt-text="Screenshot of creating a new linked service with Azure Synapse UI."::: |
| 50 | + |
| 51 | +2. Search for Microsoft Fabric Lakehouse and select the connector. |
| 52 | + |
| 53 | + :::image type="content" source="media/connector-microsoft-fabric-lakehouse/microsoft-fabric-lakehouse-connector.png" alt-text="Screenshot showing select Microsoft Fabric Lakehouse connector."::: |
| 54 | + |
| 55 | +1. Configure the service details, test the connection, and create the new linked service. |
| 56 | + |
| 57 | + :::image type="content" source="media/connector-microsoft-fabric-lakehouse/configure-microsoft-fabric-lakehouse-linked-service.png" alt-text="Screenshot of configuration for Microsoft Fabric Lakehouse linked service."::: |
| 58 | + |
| 59 | + |
| 60 | +## Connector configuration details |
| 61 | + |
| 62 | +The following sections provide details about properties that are used to define Data Factory entities specific to Microsoft Fabric Lakehouse. |
| 63 | + |
| 64 | +## Linked service properties |
| 65 | + |
| 66 | +The Microsoft Fabric Lakehouse connector supports the following authentication types. See the corresponding sections for details: |
| 67 | + |
| 68 | +- [Service principal authentication](#service-principal-authentication) |
| 69 | + |
| 70 | +### Service principal authentication |
| 71 | + |
| 72 | +To use service principal authentication, follow these steps. |
| 73 | + |
| 74 | +1. Register an application with the Microsoft Identity platform. To learn how, see [Quickstart: Register an application with the Microsoft identity platform](../active-directory/develop/quickstart-register-app.md). Make note of these values, which you use to define the linked service: |
| 75 | + |
| 76 | + - Application ID |
| 77 | + - Application key |
| 78 | + - Tenant ID |
| 79 | + |
| 80 | +2. Grant the service principal at least the **Contributor** role in Microsoft Fabric workspace. Follow these steps: |
| 81 | + 1. Go to your Microsoft Fabric workspace, select **Manage access** on the top bar. Then select **Add people or groups**. |
| 82 | + |
| 83 | + :::image type="content" source="media/connector-microsoft-fabric-lakehouse/fabric-workspace-manage-access.png" alt-text="Screenshot shows selecting Fabric workspace Manage access."::: |
| 84 | + |
| 85 | + :::image type="content" source="media/connector-microsoft-fabric-lakehouse/manage-access-pane.png" alt-text=" Screenshot shows Fabric workspace Manage access pane."::: |
| 86 | + |
| 87 | + 1. In **Add people** pane, enter your service principal name, and select your service principal from the drop-down list. |
| 88 | + |
| 89 | + 1. Specify the role as **Contributor** or higher (Admin, Member), then select **Add**. |
| 90 | + |
| 91 | + :::image type="content" source="media/connector-microsoft-fabric-lakehouse/select-workspace-role.png" alt-text="Screenshot shows adding Fabric workspace role."::: |
| 92 | + |
| 93 | + 1. Your service principal is displayed on **Manage access** pane. |
| 94 | + |
| 95 | +These properties are supported for the linked service: |
| 96 | + |
| 97 | +| Property | Description | Required | |
| 98 | +|:--- |:--- |:--- | |
| 99 | +| type | The type property must be set to **Lakehouse**. |Yes | |
| 100 | +| workspaceId | The Microsoft Fabric workspace ID. | Yes | |
| 101 | +| artifactId | The Microsoft Fabric Lakehouse object ID. | Yes | |
| 102 | +| tenant | Specify the tenant information (domain name or tenant ID) under which your application resides. Retrieve it by hovering the mouse in the upper-right corner of the Azure portal. | Yes | |
| 103 | +| servicePrincipalId | Specify the application's client ID. | Yes | |
| 104 | +| servicePrincipalCredentialType | The credential type to use for service principal authentication. Allowed values are **ServicePrincipalKey** and **ServicePrincipalCert**. | Yes | |
| 105 | +| servicePrincipalCredential | The service principal credential. <br/> When you use **ServicePrincipalKey** as the credential type, specify the application's key. Mark this field as **SecureString** to store it securely, or [reference a secret stored in Azure Key Vault](store-credentials-in-key-vault.md). <br/> When you use **ServicePrincipalCert** as the credential, reference a certificate in Azure Key Vault, and ensure the certificate content type is **PKCS #12**.| Yes | |
| 106 | +| azureCloudType | For service principal authentication, specify the type of Azure cloud environment to which your Azure Active Directory application is registered. <br/> Allowed values are **AzurePublic**, **AzureChina**, **AzureUsGovernment**, and **AzureGermany**. By default, the data factory or Synapse pipeline's cloud environment is used. | No | |
| 107 | +| connectVia | The [integration runtime](concepts-integration-runtime.md) to be used to connect to the data store. You can use the Azure integration runtime or a self-hosted integration runtime if your data store is in a private network. If not specified, the default Azure integration runtime is used. |No | |
| 108 | + |
| 109 | +**Example: using service principal key authentication** |
| 110 | + |
| 111 | +You can also store service principal key in Azure Key Vault. |
| 112 | + |
| 113 | +```json |
| 114 | +{ |
| 115 | + "name": "MicrosoftFabricLakehouseLinkedService", |
| 116 | + "properties": { |
| 117 | + "type": "Lakehouse", |
| 118 | + "typeProperties": { |
| 119 | + "workspaceId": "<Microsoft Fabric workspace ID>", |
| 120 | + "artifactId": "<Microsoft Fabric Lakehouse object ID>", |
| 121 | + "tenant": "<tenant info, e.g. microsoft.onmicrosoft.com>", |
| 122 | + "servicePrincipalId": "<service principal id>", |
| 123 | + "servicePrincipalCredentialType": "ServicePrincipalKey", |
| 124 | + "servicePrincipalCredential": { |
| 125 | + "type": "SecureString", |
| 126 | + "value": "<service principal key>" |
| 127 | + } |
| 128 | + }, |
| 129 | + "connectVia": { |
| 130 | + "referenceName": "<name of Integration Runtime>", |
| 131 | + "type": "IntegrationRuntimeReference" |
| 132 | + } |
| 133 | + } |
| 134 | +} |
| 135 | +``` |
| 136 | + |
| 137 | +## Dataset properties |
| 138 | + |
| 139 | +For a full list of sections and properties available for defining datasets, see the [Datasets](concepts-datasets-linked-services.md) article. |
| 140 | + |
| 141 | +The following properties are supported for Microsoft Fabric Lakehouse Table dataset: |
| 142 | + |
| 143 | +| Property | Description | Required | |
| 144 | +| :-------- | :----------------------------------------------------------- | :-------------------------- | |
| 145 | +| type | The **type** property of the dataset must be set to **LakehouseTable**. | Yes | |
| 146 | +| schema | Name of the schema. |No for source. Yes for sink | |
| 147 | +| table | Name of the table/view. |No for source. Yes for sink | |
| 148 | + |
| 149 | +### Dataset properties example |
| 150 | + |
| 151 | +```json |
| 152 | +{ |
| 153 | + "name": "LakehouseTableDataset", |
| 154 | + "properties": { |
| 155 | + "type": "LakehouseTable", |
| 156 | + "linkedServiceName": { |
| 157 | + "referenceName": "<Microsoft Fabric Lakehouse linked service name>", |
| 158 | + "type": "LinkedServiceReference" |
| 159 | + }, |
| 160 | + "typeProperties": { |
| 161 | + "table": "<table_name>" |
| 162 | + }, |
| 163 | + "schema": [< physical schema, optional, retrievable during authoring >] |
| 164 | + } |
| 165 | +} |
| 166 | +``` |
| 167 | + |
| 168 | +## Copy activity properties |
| 169 | + |
| 170 | +For a full list of sections and properties available for defining activities, see [Copy activity configurations](copy-activity-overview.md#configuration) and [Pipelines and activities](concepts-pipelines-activities.md). This section provides a list of properties supported by the Microsoft Fabric Lakehouse Table source and sink. |
| 171 | + |
| 172 | +### Microsoft Fabric Lakehouse Table as a source type |
| 173 | + |
| 174 | +To copy data from Microsoft Fabric Lakehouse Table, set the **type** property in the Copy Activity source to **LakehouseTableSource**. The following properties are supported in the Copy Activity **source** section: |
| 175 | + |
| 176 | +| Property | Description | Required | |
| 177 | +| :--------------------------- | :----------------------------------------------------------- | :------- | |
| 178 | +| type | The **type** property of the Copy Activity source must be set to **LakehouseTableSource**. | Yes | |
| 179 | +| timestampAsOf | The timestamp to query an older snapshot. | No | |
| 180 | +| versionAsOf | The version to query an older snapshot. | No | |
| 181 | + |
| 182 | +**Example: Microsoft Fabric Lakehouse Table source** |
| 183 | + |
| 184 | +```json |
| 185 | +"activities":[ |
| 186 | + { |
| 187 | + "name": "CopyFromLakehouseTable", |
| 188 | + "type": "Copy", |
| 189 | + "inputs": [ |
| 190 | + { |
| 191 | + "referenceName": "<Microsoft Fabric Lakehouse Table input dataset name>", |
| 192 | + "type": "DatasetReference" |
| 193 | + } |
| 194 | + ], |
| 195 | + "outputs": [ |
| 196 | + { |
| 197 | + "referenceName": "<output dataset name>", |
| 198 | + "type": "DatasetReference" |
| 199 | + } |
| 200 | + ], |
| 201 | + "typeProperties": { |
| 202 | + "source": { |
| 203 | + "type": "LakehouseTableSource", |
| 204 | + "timestampAsOf": "2023-09-23T00:00:00.000Z", |
| 205 | + "versionAsOf": 2 |
| 206 | + }, |
| 207 | + "sink": { |
| 208 | + "type": "<sink type>" |
| 209 | + } |
| 210 | + } |
| 211 | + } |
| 212 | +] |
| 213 | +``` |
| 214 | + |
| 215 | +### Microsoft Fabric Lakehouse Table as a sink type |
| 216 | + |
| 217 | +To copy data from Microsoft Fabric Lakehouse Table, set the **type** property in the Copy Activity source to **LakehouseTableSink**. The following properties are supported in the Copy activity **sink** section: |
| 218 | + |
| 219 | +| Property | Description | Required | |
| 220 | +| :--------------------------- | :----------------------------------------------------------- | :------- | |
| 221 | +| type | The **type** property of the Copy Activity source must be set to **LakehouseTableSink**. | Yes | |
| 222 | +| tableActionOption | The way to write data to the sink table. Allowed values are `Append` and `Overwrite`. | No | |
| 223 | +| partitionOption | Allowed values are `None` and `PartitionByKey`. Create partitions in folder structure based on one or multiple columns when the value is `PartitionByKey`. Each distinct column value (pair) will be a new partition (e.g. year=2000/month=01/file). It supports insert-only mode and requires an empty directory in sink. | No | |
| 224 | +| partitionNameList | The destination columns in schemas mapping. Supported data types are string, integer, boolean and datetime. Format respects type conversion settings under "Mapping" tab. | No | |
| 225 | + |
| 226 | +**Example: Microsoft Fabric Lakehouse Table sink** |
| 227 | + |
| 228 | +```json |
| 229 | +"activities":[ |
| 230 | + { |
| 231 | + "name": "CopyToLakehouseTable", |
| 232 | + "type": "Copy", |
| 233 | + "inputs": [ |
| 234 | + { |
| 235 | + "referenceName": "<input dataset name>", |
| 236 | + "type": "DatasetReference" |
| 237 | + } |
| 238 | + ], |
| 239 | + "outputs": [ |
| 240 | + { |
| 241 | + "referenceName": "<Microsoft Fabric Lakehouse Table output dataset name>", |
| 242 | + "type": "DatasetReference" |
| 243 | + } |
| 244 | + ], |
| 245 | + "typeProperties": { |
| 246 | + "source": { |
| 247 | + "type": "<source type>" |
| 248 | + }, |
| 249 | + "sink": { |
| 250 | + "type": "LakehouseTableSink", |
| 251 | + "tableActionOption ": "Append" |
| 252 | + } |
| 253 | + } |
| 254 | + } |
| 255 | +] |
| 256 | +``` |
| 257 | + |
| 258 | +## Next steps |
| 259 | + |
| 260 | +For a list of data stores supported as sources and sinks by the copy activity, see [Supported data stores](copy-activity-overview.md#supported-data-stores-and-formats). |
0 commit comments