Azure CLI tools, Credentials have expired, please reauthenticate

After installing Azure CLI tools and trying to use them on the first time on Windows, I started getting “Credentials have expired, please reauthenticate Detailed error message from ADAL is as follows: Error: Entry not found in cache.” error message. A regular logout/login did not fix the issue in my case.

I did not figure out the exact reason for the error, but a fix was simple. First logout using

azure logout <username>@<domain>

Then issue a command to clean up(?) the credentials:

%APPDATA%\npm\node_modules\azure-cli\bin\windows\creds.exe  -d -t AzureXplatCli:target=* -g

And after that login again.