Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a pre-deployment check that detects in-progress ARM deployments at the target scope and waits for them to complete, avoiding DeploymentActive failures during provisioning.
Changes:
- Introduces
waitForActiveDeployments()in the Bicep provisioning flow and polls until deployments clear or a timeout is reached. - Adds
IsActiveDeploymentState()plus new tests to classify which provisioning states are considered “active”. - Extends
infra.ScopewithListActiveDeployments()and adds aDeploymentActiveerror suggestion rule.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/resources/error_suggestions.yaml | Adds a user-facing suggestion for DeploymentActive ARM errors. |
| cli/azd/pkg/infra/scope.go | Extends scope interface + implements ListActiveDeployments() for RG and subscription scopes. |
| cli/azd/pkg/infra/provisioning/bicep/bicep_provider.go | Adds wait loop before deployment submission, with polling/timeout defaults. |
| cli/azd/pkg/infra/provisioning/bicep/bicep_provider_test.go | Updates mocked scope to satisfy the new Scope interface. |
| cli/azd/pkg/infra/provisioning/bicep/active_deployment_check_test.go | Adds tests covering wait-loop behavior, errors, cancellation, and timeout. |
| cli/azd/pkg/azapi/deployments.go | Adds IsActiveDeploymentState() helper. |
| cli/azd/pkg/azapi/deployment_state_test.go | Adds unit tests for active/inactive state classification. |
Before starting a Bicep deployment, check the target scope for in-progress ARM deployments and wait for them to complete. This avoids the DeploymentActive error that ARM returns after ~5 minutes when a concurrent deployment is already running on the same resource group. Changes: - Add IsActiveDeploymentState() helper in azapi to classify provisioning states as active or terminal. - Add ListActiveDeployments() to the infra.Scope interface and both ResourceGroupScope / SubscriptionScope implementations. - Add waitForActiveDeployments() in the Bicep provider, called after preflight validation and before deployment submission. It polls until active deployments clear or a 30-minute timeout is reached. - Add a DeploymentActive error suggestion rule to error_suggestions.yaml. - Add unit tests for state classification, polling, timeout, error handling, and context cancellation. Fixes #7248 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…per, refresh timeout names - Fix 'range 200' compile error (not valid in all Go versions) - Make DeploymentActive YAML rule scope-agnostic - Extract filterActiveDeployments helper to deduplicate scope logic - Refresh deployment names from latest poll on timeout message Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f456f95 to
8829c13
Compare
Member
Author
Telemetry Context: DeploymentActive + Retry BehaviorThis PR addresses Retry behavior makes this especially valuableOf machines that hit
Time savings
This is a clean win — the fix is architecturally simple (poll + wait) and eliminates a category of failure that can never be solved by retrying. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #7248
Before starting a deployment, azd now checks for active deployments on the target scope. If another deployment is in progress, it warns the user and waits for it to complete — avoiding the
DeploymentActiveARM error that wastes ~5 minutes of the user's time.Telemetry Context
DeploymentActivefailures in March (~270/month projected)provision, 19% fromupChanges
Pre-deployment active check (
bicep_provider.go)Added
waitForActiveDeployments()between preflight validation and deployment submission:ErrDeploymentsNotFound(scope doesn't exist yet); other errors propagateActive state classification (
deployments.go)IsActiveDeploymentState()classifies 11 provisioning states as active, including transitional states (Canceling,Deleting,DeletingResources,UpdatingDenyAssignments) that can still block new deployments.Scope interface (
scope.go)Added
ListActiveDeployments()to bothResourceGroupScopeandSubscriptionScope.Error suggestion (
error_suggestions.yaml)Added
DeploymentActiverule with user-friendly message and ARM troubleshooting link.Test Coverage (8 tests, 24 subtests)
TestIsActiveDeploymentStateTestWaitForActiveDeployments_NoActiveTestWaitForActiveDeployments_InitialListError_NotFoundTestWaitForActiveDeployments_InitialListError_OtherTestWaitForActiveDeployments_ActiveThenClearTestWaitForActiveDeployments_CancelledContextTestWaitForActiveDeployments_PollErrorTestWaitForActiveDeployments_TimeoutRelated