Share via

Why does my C# code keep failing with “Resource cannot be updated during provisioning” even after multiple retries and delays?

Rifatul Islam 0 Reputation points
2026-03-24T10:01:41.33+00:00

"error": { "code": "BadRequest", "message": "Resource cannot be updated during provisioning", "target": "orbitaxbdltdstorageventtrigger", "details": null }

code:

        int maxRetries = 2;

        int delaySeconds = 180;

        for (int i = 0; i < maxRetries; i++)

        {

            try

            {

                triggerResource = await dataFactory.GetDataFactoryTriggers().GetAsync(triggerName);

                Logger.Info($"OC|AzureService|StartTrigger : Trigger {triggerName} starting....");

                await triggerResource.Value.StartAsync(WaitUntil.Completed);

                Logger.Info($"OC|AzureService|StartTrigger : Trigger {triggerName} started successfully.");

                break; // Success! Exit the loop.

            }

            catch (Exception ex)

            {

                Logger.Error($"OC|AzureService|StartTrigger : Failed to start trigger {triggerName}-{ex.Message}");

                await Task.Delay(TimeSpan.FromSeconds(delaySeconds));

            }

        }

    }
Azure Data Factory
Azure Data Factory

An Azure service for ingesting, preparing, and transforming data at scale.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Divyesh Govaerdhanan 10,850 Reputation points Volunteer Moderator
    2026-03-25T22:37:48.8666667+00:00

    Hi Rifatul Islam,

    Welcome to Microsoft Q&A,

    The root cause here is that your retry loop is using a fixed time delay (180 seconds) without first checking whether the trigger has actually finished provisioning before attempting to start it again. The ADF trigger goes through an intermediate Provisioning state after being created, modified, or stopped, and calling StartAsync while it is in that state always returns this error, regardless of how long you wait.

    The fix: poll the trigger's provisioning state before calling StartAsync

    Instead of retrying blindly after a fixed delay, check that the trigger's ProvisioningState is Succeeded before attempting to start it.

    triggerResource = await dataFactory.GetDataFactoryTriggers().GetAsync(triggerName); 
    
    var provisioningState = triggerResource.Value.Data.Properties.ProvisioningState;
    

    Your current code retries up to 2 times with 180-second delays, but it does not check whether the trigger is actually in a stable state before each attempt. If the trigger takes longer than 180 seconds to finish provisioning (which can happen for storage event triggers with large subscriber counts or during ADF backend updates), all retries will hit the same error. This is a known pattern, adding a wait between trigger operations avoids the error, but the wait duration needs to be long enough for provisioning to complete, and using a fixed delay is unreliable

    Please Upvote and accept the answer if it helps!!


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.