# Deployment stack deny settings (Azure RBAC deny assignment)

Facts read 10 Nov 2026. Page reviewed 16 Nov 2026.

Deployment stack deny settings (Azure RBAC deny assignment) is an Azure guardrail written in Azure RBAC deny assignments. A deployment stack created with deny settings makes Azure create a deny assignment that blocks delete (denyDelete) or write and delete (denyWriteAndDelete) on the resources the stack manages, even for users whose role assignments would allow it.

```text
Documented deny settings (deployment stacks):
DenySettingsMode : Defines the operations that are prohibited on the managed resources to safeguard against unauthorized security principals attempting to delete or update them. This restriction applies to everyone unless you explicitly grant access. The values include: None , DenyDelete , and DenyWriteAndDelete .

Azure CLI example from the documentation (resource group scope):
az stack group create \
--name '<deployment-stack-name>' \
--resource-group '<resource-group-name>' \
--template-file '<bicep-file-name>' \
--action-on-unmanage 'detachAll' \
--deny-settings-mode 'denyDelete' \
--deny-settings-excluded-actions 'Microsoft.Compute/virtualMachines/write Microsoft.StorageAccounts/delete' \
--deny-settings-excluded-principals '<object-id> <object-id>'
```

- **Blocks:** A deployment stack created with deny settings makes Azure create a deny assignment that blocks delete (denyDelete) or write and delete (denyWriteAndDelete) on the resources the stack manages, even for users whose role assignments would allow it.
- **Breaks:** The deny setting applies only to resources the stack defines explicitly, not to resources created implicitly, and you can exclude at most five principals. ([source](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/deployment-stacks))
- **Test before applying:** As for every Azure RBAC deny assignments guardrail: [how to test before enforcing](/mechanisms/rbac-deny-assignment/)
- **Mechanism:** [Azure RBAC deny assignments (created by deployment stacks)](/mechanisms/rbac-deny-assignment/): Principals named in the deny assignment (all principals when the zero GUID is used), on the managed resources and optionally their child scopes
- **Taken from:** [provider documentation](https://learn.microsoft.com/en-us/azure/role-based-access-control/deny-assignments), provider documentation

## What the source says

"You can specify deny settings when creating a deployment stack, which creates a deny assignment that the deployment stack resources own." (read 10 Nov 2026).

On what it breaks: "The deny setting only applies to explicitly created resources, not implicitly created ones."

## Related guardrails

- [Deny member accounts leaving the organization](/guardrails/aws-scp-deny-leave-org/): AWS, Service control policies (SCPs), organization integrity
- [Deny billing, tax and account contact changes](/guardrails/aws-scp-deny-billing-and-contact-changes/): AWS, Service control policies (SCPs), organization integrity
- [Restrict access to resources in a suspended OU](/guardrails/aws-rcp-restrict-suspended-ou-resources/): AWS, Resource control policies (RCPs), organization integrity
- [Do not allow deletion of resource types](/guardrails/azure-policy-deny-action-delete/): Azure, Azure Policy (built-in definitions), organization integrity
- [Resource locks (CanNotDelete and ReadOnly)](/guardrails/azure-lock-cannotdelete-readonly/): Azure, Azure resource locks, organization integrity

## Related pages

- [Resource locks (CanNotDelete and ReadOnly) (Azure Azure resource locks)](/guardrails/azure-lock-cannotdelete-readonly/)
- [Allowed locations assigned at a management group (Azure Management group assignment)](/guardrails/azure-mg-assignment-allowed-locations/)
- [Disable service account key creation (Google Cloud Organization Policy Service)](/guardrails/gcp-orgpolicy-disable-sa-key-creation/)

## Sources

- Deployment stack deny settings (Azure RBAC deny assignment): https://learn.microsoft.com/en-us/azure/role-based-access-control/deny-assignments (read 10 Nov 2026)
- What it breaks: https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/deployment-stacks (read 10 Nov 2026)

Last reviewed 16 Nov 2026. Canonical: https://cloudgovernancetools.com/guardrails/azure-deny-assignment-deployment-stack/
