简体   繁体   中英

Getting HTTP Status Code: BadRequest when creating Azure Data Factory Trigger using PowerShell with AzureRm module

I am deploying Azure ADF trigger using PowerShell, all triggers deploying successfully except one trigger. I am getting the following error

[ERROR] Set-AzureRmDataFactoryV2Trigger : HTTP Status Code: BadRequest
[ERROR] Error Code: BadRequest
[ERROR] Error Message: The document creation or update failed because of invalid 
[ERROR] reference 'pipeline1'
[ERROR] Request Id: 895u9iuy-4j34-227f-63d3-948jd8djw86e
[ERROR] Timestamp (Utc):07/13/2020 16:52:28
[ERROR] At C:\Users\user1\source\repos\MyProject\PowerShell\Deploy-AdFTr
[ERROR] iggersWithDLS.ps1:290 char:21
[ERROR] + ...             Set-AzureRmDataFactoryV2Trigger -ResourceGroupName $stora ...
[ERROR] +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ERROR]     + CategoryInfo          : CloseError: (:) [Set-AzureRmDataFactoryV2Trigger 
[ERROR]    ], CloudException
[ERROR]     + FullyQualifiedErrorId : Microsoft.Azure.Commands.DataFactoryV2.SetAzureD 
[ERROR]    ataFactoryTriggerCommand
[ERROR]  

My PowerShell code is below.

$isTriggerExist = Get-AzureRmDataFactoryV2Trigger -ResourceGroupName $storageAccountRG -DataFactoryName $dataFactoryName -TriggerName $triggerObject.Name -ErrorAction:SilentlyContinue
if($isTriggerExist -eq $null)
{
    Set-AzureRmDataFactoryV2Trigger -ResourceGroupName $storageAccountRG -DataFactoryName $dataFactoryName -Name $triggerObject.Name -DefinitionFile $file -Force
    if($runTimeState[$g] -eq "Started")
    {
        Start-AzureRmDataFactoryV2Trigger -ResourceGroupName $storageAccountRG -DataFactoryName $dataFactoryName -TriggerName $triggerObject.name -Force
    }
}

I am sharing the trigger's JSON code.

{
"name": "trg_pipline1",
"properties": {
    "annotations": [],
    "runtimeState": "Started",
    "pipelines": [
        {
            "pipelineReference": {
                "referenceName": "pipeline1",
                "type": "PipelineReference"
            }
        }
    ],
    "type": "ScheduleTrigger",
    "typeProperties": {
        "recurrence": {
            "frequency": "week",
            "interval": 1,
            "startTime": "2019-10-10T00:00:00Z",
            "endTime": "2022-12-14T01:00:00Z",
            "timeZone": "UTC",
            "schedule": {
                "hours": [
                    11,
                    13,
                    15,
                    17,
                    19,
                    21,
                    23
                ],
                "weekDays": [
                    "Monday",
                    "Tuesday",
                    "Wednesday",
                    "Thursday",
                    "Friday"
                ]
            }
        }
    }
}

}

This error looks similar to this .

  • Could you please ensure that pipeline1 is deployed completely before you deploy trg_pipline1 ?
  • Also, can you verify if the steps given here are followed to create the Trigger? (Try removing "runtimeState": "Started" )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM