Azure CLI won't upgrade to the latest version

I've been spending a lot of time recently with the Azure CLI. If you don't have it already, download Node.js and then run:

npm install -g azure-cli  

Followed by:

azure login  

The problem I faced, was on one machine, despite installing the latest version from npm:

An older version always ran:

The solution

After much confusion and digging, I noticed this in my path:

C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\wbin  

And that's when the penny dropped. I have the Azure SDK installed on this machine, and it comes bundled with the the azure command. Because it's folder was ahead of the Node global packages folder in my PATH, the bundled azure command was always run.

Simply renaming C:\Program Files (x86)\Microsoft SDKs\Azure\CLI allows the azure command to run from npm: