|
| 1 | +--- |
| 2 | +title: Stop dev boxes automatically when a user disconnects. |
| 3 | +titleSuffix: Microsoft Dev Box |
| 4 | +description: Learn how to automatically stop a dev box when a user disconnects by configuring the auto stop setting on the Dev Box Pool. |
| 5 | + |
| 6 | + |
| 7 | +services: dev-box |
| 8 | +ms.service: dev-box |
| 9 | +ms.custom: devx-track-azurecli |
| 10 | +author: dhruvchand |
| 11 | +ms.author: dhruvmu |
| 12 | +ms.date: 01/10/2024 |
| 13 | +ms.topic: how-to |
| 14 | + |
| 15 | +#Customer intent: As a Dev Box administrator, I want to configure dev boxes to stop when a user disconnects so that I can control costs. |
| 16 | +--- |
| 17 | + |
| 18 | +# Auto-stop your Dev Boxes when users disconnect |
| 19 | + |
| 20 | + |
| 21 | +To save on costs, you can configure your Dev Box pools to stop when a user disconnects from their RDP session, after a timeout period that you can configure. Microsoft Dev Box attempts to stop all dev boxes after a user disconnects, and they do not re-establish a new RDP session within the configured timeout period. |
| 22 | + |
| 23 | +> [!NOTE] |
| 24 | +> Stop on disconnect will only apply to Dev Boxes that are created with hibernation enabled Dev Box definitions. To learn more about enabling hibernation on your Dev Box definitions, see [how to configure dev box hibernation](./how-to-configure-dev-box-hibernation.md). |
| 25 | +
|
| 26 | +## Permissions |
| 27 | + |
| 28 | +To manage a dev box schedule, you need the following permissions: |
| 29 | + |
| 30 | +| Action | Permission required | |
| 31 | +|---|---| |
| 32 | +| _Configure a schedule_ | Owner, Contributor, or DevCenter Project Admin. | |
| 33 | + |
| 34 | + |
| 35 | +## Manage an auto-stop schedule with the Azure CLI |
| 36 | + |
| 37 | +You can manage stop on disconnect settings on dev box pools by using the Azure CLI. |
| 38 | + |
| 39 | + |
| 40 | +### Update a pool with stop on disconnect |
| 41 | + |
| 42 | +The following Azure CLI command enables stop on disconnect on a dev box pool: |
| 43 | + |
| 44 | +```azurecli |
| 45 | +az devcenter admin pool update --pool-name {poolName} --project {projectName} --resource-group {resourceGroupName} --stop-on-disconnect status="Enabled" grace-period-minutes="180" |
| 46 | +``` |
| 47 | + |
| 48 | +| Parameter | Value | |
| 49 | +|---|---| |
| 50 | +| `pool-name` | Name of your dev box pool. | |
| 51 | +| `project` | Name of your dev box project. | |
| 52 | +| `resource-group` | Name of the resource group for your dev box pool. | |
| 53 | +| `grace-period-minutes` | Duration to wait after the user disconnects from an RDP session before stopping the dev box, in minutes| |
| 54 | +| `status` | Indicates whether the schedule is in use. The options include `Enabled` or `Disabled`. | |
| 55 | + |
| 56 | +### Disable stop on disconnect |
| 57 | + |
| 58 | +The following Azure CLI command disables stop on disconnect on a dev box pool: |
| 59 | + |
| 60 | +```azurecli |
| 61 | +az devcenter admin pool update --pool-name {poolName} --project {projectName} --resource-group {resourceGroupName} --stop-on-disconnect status="Disabled" |
| 62 | +``` |
| 63 | + |
| 64 | +| Parameter | Value | |
| 65 | +|---|---| |
| 66 | +| `pool-name` | Name of your dev box pool. | |
| 67 | +| `project-name` | Name of your dev box project. | |
| 68 | + |
| 69 | +## Related content |
| 70 | +- [How to configure dev box hibernation](./how-to-configure-dev-box-hibernation.md) |
| 71 | +- [Manage a dev box definition](./how-to-manage-dev-box-definitions.md) |
| 72 | +- [Manage a dev box by using the developer portal](./how-to-create-dev-boxes-developer-portal.md) |
0 commit comments