Using
Deployment Stacks
Last reviewed
How I run Bicep when I want lifecycle management without juggling state like in Terraform. Easy and fast, as long as you know what a stack doesn't own.
Why I use them
- No state to juggle. Unlike Terraform, the stack itself records what I deployed.
- Easy and fast, and works out of the box with Bicep and the Azure CLI.
- A resource taken out of the template is deleted or detached, per
--action-on-unmanage.
How I run them
Two previews, then an approved deploy. Both show property changes; stack what-if adds what the stack would delete or detach and filters noise against its last deploy (since 13 Aug 2026).
az stack-whatif sub create --name <result> --location <region> \
--stack-id <stack-id> --parameters <config>.bicepparam \
--action-on-unmanage deleteAll --deny-settings-mode <mode> \
--retention-interval PT1H
az stack sub create --name <stack> --location <region> \
--parameters <config>.bicepparam \
--action-on-unmanage deleteAll --deny-settings-mode <mode> --yes
Where it stops
- Entra resources from the Microsoft Graph provider can't be part of a stack.
- Anything created implicitly, for example by a
deploymentScript, doesn't land in the stack and isn't bound to its lifecycle. - With
deleteAll, a deployment flag going from true to false is a delete switch.
Links
- Deployment stacks — Lifecycle, deny settings and cleanup behaviour.
- Preview deployment stack changes with what-if — How stack what-if works, its noise filter and how long results are kept.
- Known issues for deployment stacks — Current limits, including the Microsoft Graph provider and implicitly created resources.
On the blog
History
- 15 Nov 2026 Checked against current docs; stack what-if shows property changes.
- 31 Oct 2026 Moved from Trialling to Using.
- 5 Aug 2026 Moved from Watching to Trialling.