All posts

Sync time on WSL with Windows

Quick tip on how to sync WSL time with Windows to fix Azure CLI token issues caused by time mismatch.

1 min read

Recently while working on Azure CLI on WSL, I started getting below error.

The ID token is not yet valid. Make sure your computer's time and time zone are both correct

I checked the time on my WSL (Ubuntu distro) using date, and it was not in sync with the Windows time. This resulted in Azure CLI authentication token to be invalid.

To fix this, I had to sync the time on WSL with Windows. To do that run the below command on WSL.

$ sudo hwclock -s