How to uninstall Azure CLI on Windows
The Azure CLI keeps your login token cache, account settings and any extensions you added in a folder under your user profile that its uninstaller never touches. This guide covers Azure CLI installed machine-wide from the Microsoft.AzureCLI winget package.
Quit anything using az first
Close any terminal running an az command. Check Task Manager (Ctrl+Shift+Esc) for az.exe before you uninstall, though it normally exits as soon as a command finishes.
Remove the app with its own uninstaller
Go to Settings › Apps › Installed apps, find Microsoft Azure CLI, and choose Uninstall, or run:
winget uninstall --id Microsoft.AzureCLI
Where the data lives
| Location | What it holds | What to do |
|---|---|---|
Program Files\Microsoft SDKs\Azure |
The az.exe binary and its bundled Python runtime |
Removed by the uninstaller; an empty Program Files\Microsoft SDKs can stay behind, which other Microsoft SDKs share, so leave it |
%USERPROFILE%\.azure |
Your login token cache, account settings and any extensions installed with az extension add, documented by Microsoft as the CLI's own data folder |
Not touched by the uninstaller; back it up if you might reinstall, or remove it yourself once you no longer need those credentials on this machine |
This test never ran az login or installed an extension, so %USERPROFILE%\.azure was never created and could not be checked.
Check the result
Run these read-only commands after the uninstall finishes, ideally from a new terminal window:
az --version
winget list --id Microsoft.AzureCLI
Test-Path "$env:ProgramFiles\Microsoft SDKs\Azure"
Test-Path "$env:USERPROFILE\.azure"
az --versionfailing with "not recognized" means the Azure CLI is gone from your PATH; printing a version means either the uninstall did not finish or another install is still on your machine.- A completed
winget listquery with no match means the package record is gone; a matching row means the uninstall did not finish. Test-Path "$env:ProgramFiles\Microsoft SDKs\Azure"returningFalsemeans the program folder is gone;Truemeans files, or just an empty folder, remain there.Test-Path "$env:USERPROFILE\.azure"returningTruemeans your token cache and settings are still there; back them up before removing them if you use Azure elsewhere.
If you installed it with winget
winget uninstall runs the same MSI uninstaller Settings › Apps uses and removes the same program files; it does not touch %USERPROFILE%\.azure.
Account and credentials
Uninstalling does not sign you out of Azure on Microsoft's side or revoke the token cached locally. Microsoft's own guidance is to remove %USERPROFILE%\.azure\msal_token_cache.bin (or .json on an older install) yourself if you do not plan to reinstall and want the cached sign-in gone.
What Mole lists
For Azure CLI installed machine-wide from winget, the uninstall review lists nothing: the MSI uninstaller removes Program Files\Microsoft SDKs\Azure, the machine PATH entry and its two registry keys by itself, so there is nothing left for Mole to offer. Mole also does not show the program folder as a row on its own for this app, because the installer's registry entry does not record an install location; check Program Files\Microsoft SDKs\Azure yourself if you want to confirm it is gone. In this test an empty Program Files\Microsoft SDKs folder was left behind, since another product could still use that shared parent; remove it yourself if nothing else does. %USERPROFILE%\.azure is not part of this list either way.
What this test covered
Tested with Azure CLI 2.90.0 installed through the x64 MSI package (no arm64 package exists for this app), machine scope, elevated. No sign-in was performed and no extension was installed during the test, so removing an install with a cached token or extensions was not verified.
