> ## Documentation Index
> Fetch the complete documentation index at: https://docs.envzero.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Locking Environments

> Lock env zero environments to prevent deploy, destroy, plan, and drift detection from running, with an optional lock reason visible to project members.

Environment locking prevents any change to the environment. While the environment is locked no deploy, destroy, plan or drift detection actions will be run.

# Who can lock and release environments

To lock or release an environment, a user needs the `Lock/Unlock Environment` permission (part of [the default "Project Admin" role](/guides/admin-guide/user-role-and-team-management/default-roles/#project-admin).

Any user with this permission can release the lock, regardless of who locked it.

# How to use

<img src="https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/environment_advanced_context_menu_showing_lock_environment_option.png?fit=max&auto=format&n=SMkZGUXJ1AhEm5OR&q=85&s=b3e394660f0d2c8143c7d3885276374a" alt="Environment advanced context menu showing the Lock Environment option" width="1900" height="412" data-path="images/guides/admin-guide/environments/environment_advanced_context_menu_showing_lock_environment_option.png" />

From the environment's advanced context menu, click on "Lock Environment". It will ask for confirmation. You can provide an optional reason, so other users will know why the environment is locked.

<Frame>
  <img src="https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/lock_environment_confirmation_dialog_with_optional_reason_field.png?fit=max&auto=format&n=SMkZGUXJ1AhEm5OR&q=85&s=e4e7fae917a4d2a3933a07c394fc2031" alt="Lock Environment confirmation dialog with optional reason field" width="1050" height="652" data-path="images/guides/admin-guide/environments/lock_environment_confirmation_dialog_with_optional_reason_field.png" />
</Frame>

Locked environments will have a banner explaining who, when and why the environment is locked, and a button to release the lock.

<img src="https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/locked_environment_banner_showing_lock_status_user_who_locked_it_and_unlock_button.png?fit=max&auto=format&n=SMkZGUXJ1AhEm5OR&q=85&s=4296f5ad9697821640fdd0cad49b1907" alt="Locked environment banner showing who locked it, when, the reason, and a Release Lock button" width="1872" height="202" data-path="images/guides/admin-guide/environments/locked_environment_banner_showing_lock_status_user_who_locked_it_and_unlock_button.png" />

# What happens when the environment is locked

* User cannot run Deploy, Destroy or [Ad hoc Task](/guides/admin-guide/environments/ad-hoc-tasks)
* [Scheduled Deploy, Destroy](/guides/admin-guide/environments/scheduling), and [Drift Detection](/guides/admin-guide/environments/drift-detection) will not run. They will resume after unlocking.
* [Continuous Deployment](/guides/admin-guide/environments/continuous-deployment), [Plan on Pull Request](/guides/admin-guide/environments/plan-on-pull-request), and [Plan and Apply from PR Comments](/guides/admin-guide/environments/plan-and-apply-from-pr-comments) will not work.
* Environment will not be destroyed due to [TTL](/guides/policies-governance/policy-ttl). After unlocking, a notification will be sent as usual, before the environment is destroyed.

## Next steps

* [Managing Bulk Operations](/guides/admin-guide/environments/bulk-operations) - Lock or unlock multiple environments at once.
* [Deployment Scheduling](/guides/admin-guide/environments/scheduling) - Schedule deploys and destroys that resume after unlocking.
* [Environment Overview](/guides/admin-guide/environments) - Review all available environment actions and states.
