title: Getting HTTP Status Code: BadRequest when creating Azure Data Factory Trigger using PowerShell with AzureRm module
body: <p>I am deploying Azure ADF trigger using PowerShell, all triggers deploying successfully except one trigger. I am getting the following error</p>
  <pre><code>[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]  
  </code></pre>
  <p>My PowerShell code is below.</p>
  <pre><code>$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 &quot;Started&quot;)
      {
          Start-AzureRmDataFactoryV2Trigger -ResourceGroupName $storageAccountRG -DataFactoryName $dataFactoryName -TriggerName $triggerObject.name -Force
      }
  }
  </code></pre>
  <p>I am sharing the trigger's JSON code.</p>
  <pre><code>{
  &quot;name&quot;: &quot;trg_pipline1&quot;,
  &quot;properties&quot;: {
      &quot;annotations&quot;: [],
      &quot;runtimeState&quot;: &quot;Started&quot;,
      &quot;pipelines&quot;: [
          {
              &quot;pipelineReference&quot;: {
                  &quot;referenceName&quot;: &quot;pipeline1&quot;,
                  &quot;type&quot;: &quot;PipelineReference&quot;
              }
          }
      ],
      &quot;type&quot;: &quot;ScheduleTrigger&quot;,
      &quot;typeProperties&quot;: {
          &quot;recurrence&quot;: {
              &quot;frequency&quot;: &quot;week&quot;,
              &quot;interval&quot;: 1,
              &quot;startTime&quot;: &quot;2019-10-10T00:00:00Z&quot;,
              &quot;endTime&quot;: &quot;2022-12-14T01:00:00Z&quot;,
              &quot;timeZone&quot;: &quot;UTC&quot;,
              &quot;schedule&quot;: {
                  &quot;hours&quot;: [
                      11,
                      13,
                      15,
                      17,
                      19,
                      21,
                      23
                  ],
                  &quot;weekDays&quot;: [
                      &quot;Monday&quot;,
                      &quot;Tuesday&quot;,
                      &quot;Wednesday&quot;,
                      &quot;Thursday&quot;,
                      &quot;Friday&quot;
                  ]
              }
          }
      }
  }
  </code></pre>
  <p>}</p>