Fix az login Key Not Valid for use

Fix az login Key Not Valid for use in specified state Decryption Error 2146893813

Recently one user reported that he was unable to log in to Azure CLI using the “az login” command, he received the following error message. He tried to log in using the admin privileges, but still he received the same error message, if you are receiving a similar error, this article will guide you to fix az login Key Not Valid for use in specified state Decryption Error 2146893813.

Error Message:

decryption failed: [winerror -2146893813] key not valid for use in specified state.. app developer may consider this guidance: https://github.com/azuread/microsoft-authentication-extensions-for-python/wiki/persistencedecryptionerror

Fix az login Key Not Valid for use in specified state Decryption Error 2146893813:

Follow the below resolution if you received the above-mentioned error, before proceeding make sure you have an updated version of Azure CLI.

Check for the Latest version of Azure CLI, if not download from the Official Microsoft Site and install the latest version.

Clear the credentials cache using the below commands to re-login:

az account clear
az login

If the above commands, didn’t resolve this issue, then there is an internal experimental config option, you can turn off the token cache encryption to resolve this issue. You can change this option whenever you want.

az config set core.encrypt_token_cache=false
az login

Reference: https://github.com/Azure/azure-cli/issues/20231

Read Also:

How to Install Azure CLI using PowerShell on Windows?

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top