事件
3月31日 下午11時 - 4月2日 下午11時
規模最大的 Fabric、Power BI 與 SQL 學習盛會。 3 月 31 日至 4 月 2 日。 使用代碼 FABINSIDER 可節省 $400。
立即報名適用於:Azure Data Factory
Azure Synapse Analytics
提示
試用 Microsoft Fabric 中的 Data Factory,這是適用於企業的全方位分析解決方案。 Microsoft Fabric 涵蓋從資料移動到資料科學、即時分析、商業智慧和報告的所有項目。 了解如何免費開始新的試用!
本快速入門說明如何使用 Azure Resource Manager 範本 (ARM 範本) 建立 Azure Data Factory。 在此資料處理站中建立的管線會將資料從 Azure Blob 儲存體中的一個資料夾複製到其他資料夾。 如需如何使用 Azure Data Factory 轉換資料的教學課程,請參閱教學課程︰使用 Spark 轉換資料。
Azure Resource Manager 範本是一個 JavaScript 物件標記法 (JSON) 檔案,會定義專案的基礎結構和設定。 範本使用宣告式語法。 您可以描述預期的部署,而不需要撰寫程式設計命令順序來建立部署。
備註
本文不提供 Data Factory 服務的詳細簡介。 如需 Azure Data Factory 服務簡介,請參閱 Azure Data Factory 簡介。
如果您的環境符合必要條件,而且您很熟悉 ARM 範本,請選取 [部署至 Azure] 按鈕。 範本會在 Azure 入口網站中開啟。
如尚未擁有 Azure 訂用帳戶,請在開始之前先建立免費帳戶。
請開啟文字編輯器 (例如 [記事本]) 並使用下列內容建立名為 emp.txt 的檔案:
John, Doe
Jane, Doe
將該檔案儲存在 C:\ADFv2QuickStartPSH 資料夾中。 (如果該資料夾不存在,請予以建立。)
本快速入門中使用的範本是來自 Azure 快速入門範本。
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.54.24096",
"templateHash": "17339534711754973978"
}
},
"parameters": {
"dataFactoryName": {
"type": "string",
"defaultValue": "[format('datafactory{0}', uniqueString(resourceGroup().id))]",
"metadata": {
"description": "Data Factory Name"
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location of the data factory."
}
},
"storageAccountName": {
"type": "string",
"defaultValue": "[format('storage{0}', uniqueString(resourceGroup().id))]",
"metadata": {
"description": "Name of the Azure storage account that contains the input/output data."
}
},
"blobContainerName": {
"type": "string",
"defaultValue": "[format('blob{0}', uniqueString(resourceGroup().id))]",
"metadata": {
"description": "Name of the blob container in the Azure Storage account."
}
}
},
"variables": {
"dataFactoryLinkedServiceName": "ArmtemplateStorageLinkedService",
"dataFactoryDataSetInName": "ArmtemplateTestDatasetIn",
"dataFactoryDataSetOutName": "ArmtemplateTestDatasetOut",
"pipelineName": "ArmtemplateSampleCopyPipeline"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts/blobServices",
"apiVersion": "2023-01-01",
"name": "[format('{0}/{1}', parameters('storageAccountName'), 'default')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
]
},
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2023-01-01",
"name": "[parameters('storageAccountName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Standard_LRS"
},
"kind": "StorageV2",
"properties": {
"minimumTlsVersion": "TLS1_2",
"supportsHttpsTrafficOnly": true,
"allowBlobPublicAccess": false
}
},
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "2023-01-01",
"name": "[format('{0}/{1}/{2}', parameters('storageAccountName'), 'default', parameters('blobContainerName'))]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', parameters('storageAccountName'), 'default')]"
]
},
{
"type": "Microsoft.DataFactory/factories",
"apiVersion": "2018-06-01",
"name": "[parameters('dataFactoryName')]",
"location": "[parameters('location')]",
"identity": {
"type": "SystemAssigned"
}
},
{
"type": "Microsoft.DataFactory/factories/linkedservices",
"apiVersion": "2018-06-01",
"name": "[format('{0}/{1}', parameters('dataFactoryName'), variables('dataFactoryLinkedServiceName'))]",
"properties": {
"type": "AzureBlobStorage",
"typeProperties": {
"connectionString": "[format('DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}', parameters('storageAccountName'), listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2023-01-01').keys[0].value)]"
}
},
"dependsOn": [
"[resourceId('Microsoft.DataFactory/factories', parameters('dataFactoryName'))]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
]
},
{
"type": "Microsoft.DataFactory/factories/datasets",
"apiVersion": "2018-06-01",
"name": "[format('{0}/{1}', parameters('dataFactoryName'), variables('dataFactoryDataSetInName'))]",
"properties": {
"linkedServiceName": {
"referenceName": "[variables('dataFactoryLinkedServiceName')]",
"type": "LinkedServiceReference"
},
"type": "Binary",
"typeProperties": {
"location": {
"type": "AzureBlobStorageLocation",
"container": "[parameters('blobContainerName')]",
"folderPath": "input",
"fileName": "emp.txt"
}
}
},
"dependsOn": [
"[resourceId('Microsoft.DataFactory/factories', parameters('dataFactoryName'))]",
"[resourceId('Microsoft.DataFactory/factories/linkedservices', parameters('dataFactoryName'), variables('dataFactoryLinkedServiceName'))]"
]
},
{
"type": "Microsoft.DataFactory/factories/datasets",
"apiVersion": "2018-06-01",
"name": "[format('{0}/{1}', parameters('dataFactoryName'), variables('dataFactoryDataSetOutName'))]",
"properties": {
"linkedServiceName": {
"referenceName": "[variables('dataFactoryLinkedServiceName')]",
"type": "LinkedServiceReference"
},
"type": "Binary",
"typeProperties": {
"location": {
"type": "AzureBlobStorageLocation",
"container": "[parameters('blobContainerName')]",
"folderPath": "output"
}
}
},
"dependsOn": [
"[resourceId('Microsoft.DataFactory/factories', parameters('dataFactoryName'))]",
"[resourceId('Microsoft.DataFactory/factories/linkedservices', parameters('dataFactoryName'), variables('dataFactoryLinkedServiceName'))]"
]
},
{
"type": "Microsoft.DataFactory/factories/pipelines",
"apiVersion": "2018-06-01",
"name": "[format('{0}/{1}', parameters('dataFactoryName'), variables('pipelineName'))]",
"properties": {
"activities": [
{
"name": "MyCopyActivity",
"type": "Copy",
"typeProperties": {
"source": {
"type": "BinarySource",
"storeSettings": {
"type": "AzureBlobStorageReadSettings",
"recursive": true
}
},
"sink": {
"type": "BinarySink",
"storeSettings": {
"type": "AzureBlobStorageWriteSettings"
}
},
"enableStaging": false
},
"inputs": [
{
"referenceName": "[variables('dataFactoryDataSetInName')]",
"type": "DatasetReference"
}
],
"outputs": [
{
"referenceName": "[variables('dataFactoryDataSetOutName')]",
"type": "DatasetReference"
}
]
}
]
},
"dependsOn": [
"[resourceId('Microsoft.DataFactory/factories', parameters('dataFactoryName'))]",
"[resourceId('Microsoft.DataFactory/factories/datasets', parameters('dataFactoryName'), variables('dataFactoryDataSetInName'))]",
"[resourceId('Microsoft.DataFactory/factories/datasets', parameters('dataFactoryName'), variables('dataFactoryDataSetOutName'))]"
]
}
],
"outputs": {
"name": {
"type": "string",
"value": "[variables('pipelineName')]"
},
"resourceId": {
"type": "string",
"value": "[resourceId('Microsoft.DataFactory/factories/pipelines', parameters('dataFactoryName'), variables('pipelineName'))]"
},
"resourceGroupName": {
"type": "string",
"value": "[resourceGroup().name]"
},
"location": {
"type": "string",
"value": "[parameters('location')]"
}
}
}
範本中定義了 Azure 資源:
您可以在快速入門範本資源庫中找到更多 Azure Data Factory 範本的範例。
選取以下影像來登入 Azure 並開啟範本。 此範本會建立一個 Azure Data Factory 帳戶、一個儲存體帳戶和一個 Blob 容器。
選取或輸入下列值。
除非有指定,否則請使用預設值來建立 Azure Data Factory 資源:
選取 [前往資源群組]。
確認是否已建立 Azure Data Factory。
確認已建立儲存體帳戶。
選取建立的儲存體帳戶,然後選取 [容器] 。
在 [容器] 頁面上,選取 [上傳]。
在右側窗格中,選取選取 [檔案] 方塊,然後選取稍早建立的 emp.txt 檔案。
展開 [進階] 標題。
在 [上傳至資料夾] 方塊中,輸入 input。
選取上傳按鈕。 您應該會在清單中看到 emp.txt 檔案以及上傳的狀態。
選取 [關閉] 圖示 (X) 以關閉 [上傳 Blob] 頁面。
將 [容器] 頁面保持開啟,因為您可以用該頁面來驗證本快速入門結尾處的輸出。
瀏覽至 [資料處理站] 頁面,選取您建立的資料管理站。
在 [開啟Azure Data Factory Studio] 圖格上選取 [開啟]。
選取 [建立者] 索引標籤 。
選取已建立的管線 - ArmtemplateSampleCopyPipeline。
選取 [新增觸發程序]>[立即觸發]。
在右側窗格的 管線執行下,選取 [確定]。
選取 [監視] 索引標籤 。
您會看到與管線執行相關聯的活動執行。 本快速入門中,管線只有一個以下類型的活動:複製。 如此,您會看到該活動的執行。
管道會自動在 Blob 容器中建立輸出資料夾。 然後,它會將 emp.txt 檔案從輸入資料夾複製到輸出資料夾。
在 Azure 入口網站的 [容器] 頁面上,選取 [重新整理] 查看輸出資料夾。
在資料夾清單中,選取 [輸出]。
確認 emp.txt 已複製到輸出資料夾。
您有兩種方式可以清除您在本快速入門中建立的資源。 您可以刪除 Azure 資源群組,其中包括資源群組中的所有資源。 如果您想要讓其他資源保持不變,請僅刪除您在本教學課程中建立的資料處理站。
刪除資源群組會刪除所有資源,包含其中的 Data Factory。 執行下列命令來刪除整個資源群組:
Remove-AzResourceGroup -ResourceGroupName $resourcegroupname
如果您需要只刪除 Data Factory,而非整個資源群組,請執行下列命令:
Remove-AzDataFactoryV2 -Name $dataFactoryName -ResourceGroupName $resourceGroupName
在本快速入門中,您已使用 ARM 範本建立了 Azure Data Factory,並已驗證了該部署。 若要深入了解 Azure Data Factory 和 Azure Resource Manager,請繼續閱讀下列文章。
事件
3月31日 下午11時 - 4月2日 下午11時
規模最大的 Fabric、Power BI 與 SQL 學習盛會。 3 月 31 日至 4 月 2 日。 使用代碼 FABINSIDER 可節省 $400。
立即報名訓練
認證
Microsoft Certified: Azure Data Engineer Associate - Certifications
展現對常見資料工程工作的了解,以使用多種 Azure 服務在 Microsoft Azure 上實作和管理資料工程工作負載。
文件
了解如何使用持續整合和傳遞將一個環境 (開發、測試、生產) 中的 Azure Data Factory 管線移至另一個環境。
了解如何在 Azure Data Factory 中設定原始檔控制。
Resource Manager 範本中的自訂參數 - Azure Data Factory
了解如何在 Resource Manager 範本中使用自訂參數,並在 Azure Data Factory 中持續整合與傳遞。