Skip to content

Start/Stop trigger: catch non-terminating Az errors so retries and warnings work #435 #508

Closed

Description

@NowinskiK

Part of #435.

Problem

Start-AzDataFactoryV2Trigger and Stop-AzDataFactoryV2Trigger report failures as non-terminating errors. With the default $ErrorActionPreference = 'Continue', the try/catch in private/Start-Trigger.ps1 and private/Stop-Trigger.ps1 never sees them:

  • no retry, no "Failed starting/stopping trigger after N attempts" message, no warning (-WarningVariable stays empty)
  • Stop-Trigger returns $true even when the trigger was not stopped, so the Adds TryCatch to StopTrigger, continuing if fails #404 retry (v1.19.0) only works when the caller uses -ErrorAction Stop (e.g. Azure DevOps AzurePowerShell@5 default)

Verified against Azure: the error is caught only with -ErrorAction Stop.

Expected

  • Add -ErrorAction Stop to the Az calls inside try, so retries and warnings work whatever the caller's preference is.
  • Do not retry permanent errors (e.g. Missing or invalid pipeline references), only temporary ones (provisioning, concurrent operations).
  • Start-Trigger returns $true/$false like Stop-Trigger; Start-Triggers reports all triggers that failed to start.
  • The deployment carries on: a failed start or stop is a warning, not an error. Details come from the Azure API message; the precise validation belongs to Test-AdfCode (see the sibling sub-issue).

Tests

Mock the Az cmdlets to write a non-terminating error (not throw), which is how the real cmdlets behave. Existing mocks that throw hid this bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions