【问题标题】:Release Azure Data Factory project using VSTS Release使用 VSTS Release 发布 Azure 数据工厂项目
【发布时间】:2018-02-01 19:00:44
【问题描述】:

我想在 Visual Studio 中创建 Azure 数据工厂项目,而不是直接在 Azure 门户中创建 Azure 数据工厂。原因是我希望将项目置于源代码管理中,因为它是一个团队项目并且为了备份它。

我想使用 Visual Studio Team Services 自动执行上述 Azure 数据工厂项目的构建和发布过程。构建过程很简单;它将是在解决方案上运行的 MSBuild。但是,我不确定如何进行发布定义。是否有任务/任务集或其他方法可以让我将 Azure 数据工厂项目部署到 Azure?

【问题讨论】:

    标签: visual-studio azure-data-factory azure-pipelines-release-pipeline


    【解决方案1】:

    您可以使用 PowerShell 部署 Azure 数据工厂。

    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
    }
    

    更多信息,可以参考这篇文章:Deploy Azure Data Factory using PowerShell

    【讨论】:

    • 当我创建一个 Azure PowerShell 任务并在其中使用上述查询时,我收到以下错误:Credential operation error: The authorization code for your linked service is invalid to generate authentication token. Please reauthorize this linked service with an account that has access to your resource and promptly redeploy the linked service. 部署工作,但它在 Azure 门户中显示“配置失败”,我有手动单击“作者和部署”部分中的“授权”按钮。我知道有 C# 代码可以自动执行此操作,但是如何与我的 PowerShell 集成?
    • @brodskyb 手动使用 PowerShell 和 Rest API 构建 azure 数据工厂会有什么结果?
    • 您的意思是我应该: 1. 使用 PowerShell 创建 ADF 2. 创建链接的服务/数据集/等。在 Visual Studio 3 中。在发布定义中使用 Azure PowerShell 来部署对 Visual Studio 中的文件所做的更改?因为如果我使用 PowerShell 创建 ADF,我将如何在 Visual Studio 中开发 ADF 的各种组件以进行源代码控制?
    • @brodskyb 不,我只是想知道,您可以手动使用 PowerShell 或 Rest API 构建数据工厂吗?只需进行测试并在此处发布结果即可。
    猜你喜欢
    • 1970-01-01
    • 2020-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多