6

我一直在尝试让数据工厂部署通过 VSTS 工作,并且大部分时间都在那里,但由于需要禁用触发器才能被覆盖,我遇到了失败。下面的错误信息:

Remove-AzureRmDataFactoryV2Trigger : HTTP Status Code: BadRequest
Error Code: TriggerEnabledCannotUpdate
Error Message: Cannot update enabled Trigger; it needs to be disabled first.
Request Id: <id number here>
Timestamp (Utc):06/17/2018 21:31:49
At line:1 char:1
+ Remove-AzureRmDataFactoryV2Trigger -ResourceGroupName "ResourceGroupName" -Data ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Remove-AzureRmDataFactoryV2Trigger], ErrorResponseException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.DataFactoryV2.RemoveAzureDataFactoryTriggerCommand

尝试进行直接部署以及手动运行 powershell 脚本以删除触发器时都会出现此错误

Remove-AzureRmDataFactoryV2Trigger -ResourceGroupName "ResourceGroupName" -DataFactoryName "DataFactoryName" -Name "TriggerName"

我找不到通过 powershell 或在发布期间禁用触发器的方法。谁能帮我找到解决方法?没有它,我无法使用数据工厂进行持续集成发布。

谢谢

4

1 回答 1

10

在删除它之前调用 Stop-AzureRmDataFactoryV2Trigger。

遍历所有定义的触发器并设置为变量

$triggersADF = Get-AzureRmDataFactoryV2Trigger -DataFactoryName <DataFactoryName> -ResourceGroupName <ResourceGroupName>

禁用所有触发器

$triggersADF | ForEach-Object { Stop-AzureRmDataFactoryV2Trigger -ResourceGroupName <ResourceGroupName> -DataFactoryName <DataFactoryName> -Name $_.name -Force }

重新启用触发器部署后

$triggersADF | ForEach-Object { Start-AzureRmDataFactoryV2Trigger -ResourceGroupName <ResourceGroupName> -DataFactoryName <DataFactoryName> -Name $_.name -Force }
于 2018-06-18T01:15:26.493 回答