Automatically wake your Azure DevBox from hibernation when you log in to your Windows laptop or unlock your workstation.
This project contains PowerShell scripts that integrate with Windows Task Scheduler to automatically wake your DevBox from hibernation at https://devbox.microsoft.com/ whenever you log in to your laptop or unlock your workstation.
Features:
- Automatic DevBox wake on Windows login and workstation unlock
- Monitors operation status until DevBox is ready
- Shows Windows toast notification when DevBox is running
- Two-button notification: Connect immediately or Hibernate if not needed
- Detailed logging with UTF-8 encoding
- Uses Azure CLI for authentication (works with corporate device policies)
- Windows 10/11
- PowerShell 5.1 or later
- Azure DevBox subscription
- Azure CLI (Download here)
- Administrator privileges (for initial scheduled task setup only)
Create a config.json file from the example template:
Copy-Item config.example.json config.jsonThen edit config.json with your DevBox information:
{
"DevBoxName": "your-devbox-name",
"ProjectName": "your-project-name",
"DevCenterName": "your-devcenter-name",
"Location": "your-location"
}How to find these values:
Run this PowerShell command to list your projects and find the correct values:
# You'll need to authenticate first if not already logged in
az login
# This will show your DevCenter name and location
# Look for these in your project details at devbox.microsoft.comOr use the DevBox MCP tools if available in your VS Code environment.
To find these values:
- DevBoxName: The name of your DevBox (visible at devbox.microsoft.com)
- ProjectName: Your DevBox project name
- DevCenterName: The actual name of your Dev Center resource (NOT the region)
- This is the unique identifier given to your Dev Center when it was created
- Examples:
mycompany-devcenter,engineering-dc,contoso-dev - You can find this in the Azure Portal or ask your Azure administrator
- Note: This is different from the region - don't use "West US 2" or similar region names here
- Location: Azure region code where your Dev Center is hosted
- Examples:
westus2,eastus,westus3,centralus - Use the short region code, not the display name
- Must match the region where your Dev Center is actually deployed
- Examples:
Tip: To discover your DevCenter name and location:
- Visit devbox.microsoft.com and inspect your DevBox details
- Ask your Azure administrator
- Use the DevBox MCP tools in VS Code if available
Install Azure CLI if you haven't already:
- Download from: https://aka.ms/installazurecliwindows
- Run the installer
- Open a new PowerShell window (to refresh PATH)
- Login to Azure:
az login
This uses Azure CLI instead of PowerShell modules, which works better with corporate device compliance policies.
Run the wake script to test:
.\Wake-DevBox.ps1If successful, you'll see log messages indicating the DevBox wake command was sent.
Run the setup script with Administrator privileges:
# Right-click PowerShell and select "Run as Administrator"
.\Setup-ScheduledTask.ps1This will create a Windows scheduled task that runs Wake-DevBox.ps1 automatically when you log in or unlock your workstation.
Check that the task was created successfully:
Get-ScheduledTask -TaskName "Wake DevBox on Login" -TaskPath "\DevBox\"Once configured, the script will automatically run when you:
- Log in to Windows
- Unlock your workstation (after locking it with Win+L or screen timeout)
No manual intervention is required.
To manually wake your DevBox without logging out:
.\Wake-DevBox.ps1Or run the scheduled task:
Start-ScheduledTask -TaskName "Wake DevBox on Login" -TaskPath "\DevBox\"The script creates a log file at wake-devbox.log in the same directory. Check this file if you encounter any issues:
Get-Content .\wake-devbox.log -Tail 20The script now uses Azure CLI instead of PowerShell modules to avoid device compliance issues.
If you see authentication errors:
-
Ensure Azure CLI is installed:
az --version -
Login with Azure CLI:
az login
-
Run the script manually to verify it works:
.\Wake-DevBox.ps1 -
Once manual execution succeeds, the scheduled task will work automatically
Note: If you previously had device compliance errors (Error 530033), using Azure CLI should resolve this issue.
-
Verify the task exists:
Get-ScheduledTask -TaskName "Wake DevBox on Login" -TaskPath "\DevBox\"
-
Check task history in Task Scheduler:
- Press
Win + R, typetaskschd.msc, press Enter - Navigate to
DevBoxfolder - Right-click the task and select "Properties" โ "History" tab
- Press
The script no longer uses PowerShell Az modules. It uses Azure CLI instead, which should be installed separately (see Prerequisites).
To remove the scheduled task:
# Run as Administrator
Unregister-ScheduledTask -TaskName "Wake DevBox on Login" -TaskPath "\DevBox\" -Confirm:$falseWake-DevBox.ps1- Main script that wakes the DevBox and monitors statusHibernate-DevBox.ps1- Script to hibernate the DevBoxHibernate-DevBox.bat- Batch wrapper for toast notification buttonShow-Toast.ps1- Helper script for Windows toast notificationsSetup-ScheduledTask.ps1- Configures Windows Task Schedulerconfig.example.json- Template configuration file (copy to config.json)config.json- Your personal DevBox configuration (excluded from git)wake-devbox.log- Log file (created at runtime)README.md- This file
- The scheduled task runs with your user privileges (not elevated)
- Azure credentials are managed securely by the Az PowerShell module
- No passwords or secrets are stored in the configuration files
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
See SECURITY.md for security policies and how to report vulnerabilities.
MIT License - See LICENSE for details.
- Built for use with Azure DevBox
- Uses Azure CLI for authentication
- ๐ Report a Bug
- ๐ก Request a Feature
- ๐ View Documentation
Note: Remember to update your config.json with your actual DevBox details and never commit it to version control!