使用VSTS版本发布Azure Data Factory项目

问题描述:

我想在Visual Studio中创建一个Azure数据工厂项目,而不是直接在Azure门户中创建一个Azure数据工厂.之所以这样,是因为我希望该项目处于源代码控制中,因为它是一个团队项目,并且为了对其进行备份.

I want to create an Azure Data Factory project in Visual Studio rather than create an Azure Data Factory directly in the Azure portal. The reason why is that I wish to have the project in source control since it is a team project and for the sake of having it backed up.

我想使用Visual Studio Team Services来自动化上述Azure Data Factory项目的生成和发布过程.构建过程很简单;这将是在解决方案上运行的MSBuild.但是,我不确定如何进行Release定义.是否有一个任务/一组任务或其他方法可以使我将Azure Data Factory项目部署到Azure中?

I want to use Visual Studio Team Services to automate the Build and Release processes for the aforementioned Azure Data Factory project. The Build process is straightforward; it will be an MSBuild run on the solution. However, I am unsure how to go about the Release definition. Is there a task/set of tasks or a different method that will allow me to deploy my Azure Data Factory project into Azure?

您可以使用PowerShell部署Azure Data Factory.

You can deploy Azure Data Factory using PowerShell.

  1. 添加Azure PowerShell步骤/任务以构建/发布定义
  2. 简单脚本:

代码:

foreach($file in Get-ChildItem "[ProjectFolder]" -filter "LinkedService*")
{
  New-AzureRmDataFactoryLinkedService -ResourceGroupName "ADF" -DataFactoryName "SampleFactory" -Name $file.BaseName -File $file.FullName -Force | Format-List
}
foreach($file in Get-ChildItem "[ProjectFolder]" -filter "DataSet*")
{
 New-AzureRmDataFactoryDataset -ResourceGroupName "ADF" -DataFactoryName "SampleFactory" -Name $file.BaseName -File $file.FullName -Force | Format-List
}
foreach($file in Get-ChildItem "[ProjectFolder]" -filter "Pipeline*")
{
 New-AzureRmDataFactoryPipeline -ResourceGroupName "ADF" -DataFactoryName "SampleFactory" -Name $file.BaseName -File $file.FullName -Force | Format-List
}

更多信息,您可以参考这篇文章:

More information, you can refer to this article: Deploy Azure Data Factory using PowerShell.