13 Feb 2024

title: Sync time on WSL with Windows tags:

  • cli
  • productivity
  • howto
  • wsl date: 2023-06-21

Recnetly 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