When azd provision (or azd up) submits a Bicep deployment to Azure, the
deployment runs asynchronously on the Azure side. If the user presses
Ctrl+C while azd is waiting for that deployment to
finish, azd will pause and ask what to do instead of exiting immediately.
- azd stops the live progress reporter and presents an interactive prompt that includes the Azure portal URL of the running deployment.
- The user picks one of:
- Leave the Azure deployment running and stop azd (default). azd exits with a non-zero status; the Azure deployment continues to completion. The user can monitor or cancel it from the portal link.
- Cancel the Azure deployment. azd submits an ARM cancel request
against the deployment and waits up to 5 minutes (a single global
budget) for Azure to confirm a terminal state (
Canceled,Failed, orSucceeded). Once the top-level deployment reachesCanceled, azd best-effort cancels and waits for any descendant (nested) deployments within the same 5-minute budget so leftover children do not keep running on Azure.
- Additional Ctrl+C presses while the prompt is showing (or while a cancel request is in flight) are ignored so the user can finish reading and choose deliberately.
| Outcome | When |
|---|---|
| Cancellation confirmed | Azure transitions the deployment to Canceled within the wait budget. azd exits non-zero with a clear message. |
| Cancel raced succeeded | Azure reached Succeeded before cancel took effect. azd surfaces this as a success-toned message — resources are deployed. |
| Cancel raced failed | Azure reached Failed before cancel took effect. azd surfaces the failure plus the portal URL. |
| Cancel raced deleted | The deployment record was deleted before cancel took effect (unusual; suggests an external actor). |
| Cancel still pending | Azure does not reach a terminal state within the wait budget. azd warns that cancellation may still complete and prints the portal URL. |
| Cancel request failed | The ARM Cancel API itself returned an error. azd surfaces that the deployment is still running and prints the portal URL. |
When the deployment URL is available, azd prints it so the user can follow up manually from the browser. The URL is omitted if azd was unable to resolve it (for example, when the ARM service is unreachable).
| Provider | Behavior on Ctrl+C during provision |
|---|---|
| Bicep (subscription scope) | Interactive prompt (described above). |
| Bicep (resource group scope) | Interactive prompt (described above). |
| Deployment Stacks | Currently treated as "leave running" — the stacks ARM API does not expose a per-deployment cancel surface today. |
| Terraform | Unchanged: the Terraform CLI does not expose a safe per-apply cancel; pressing Ctrl+C exits azd and Terraform handles its own teardown. |
A provision.cancellation attribute is recorded on the provisioning span
with one of:
none— provisioning completed normally without an interrupt.leave_running— user chose to let the Azure deployment continue.canceled— cancel request succeeded and Azure reachedCanceled.cancel_raced_succeeded— Azure reachedSucceededbefore cancel took effect (resources are deployed; we surface this as a success-toned message rather than a failure).cancel_raced_failed— Azure reachedFailedbefore cancel took effect.cancel_raced_deleted— the deployment record was deleted before cancel could take effect (unusual; suggests an external actor).cancel_too_late— fallback for unexpected terminal states (kept for backwards-compat; the threecancel_raced_*values cover the documented terminal states).cancel_timed_out— top-level deployment did not reach a terminal state within the wait budget (5 minutes).cancel_timed_out_nested— top-level reachedCanceled, but one or more descendant (nested) deployments did not reach a terminal state within the same 5-minute global budget. The user-facing output lists the stuck deployment(s) with portal links so they can be investigated manually.cancel_failed— the ARMCancelAPI call itself returned an error.
If azd is running without a TTY (e.g. CI), the prompt cannot be displayed. In that case azd defaults to leave running behavior so that an unattended deployment is never silently cancelled by an environment signal.