簡體   English   中英

使用 PowerShell 和 AzureRm 模塊創建 Azure 數據工廠觸發器時獲取 HTTP 狀態代碼:BadRequest

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

我正在使用 PowerShell 部署 Azure ADF 觸發器,除一個觸發器外,所有觸發器都成功部署。 我收到以下錯誤

[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]  

我的 PowerShell 代碼如下。

$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
    }
}

我正在分享觸發器的 JSON 代碼。

{
"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"
                ]
            }
        }
    }
}

}

此錯誤與類似。

  • 您能否確保在部署trg_pipline1之前完全部署pipeline1
  • 此外,您能否驗證是否遵循此處給出的步驟來創建觸發器? (嘗試刪除"runtimeState": "Started"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM