none
Error when trying to Add-AzureAccount RRS feed

  • Question

  • Getting an error when trying to do the initial setup of a Azure PS.  I have done this many times on different machines, and on this particular machine I have uninstalled and reinstalled Azure PS a few times now to no avail.  I am simply issuing add-AzureAccount and expecting to get the pop up menu where I can type in my account information-as simple as can be.  However it keeps spitting out this error message:

    add-azureaccount : Key not valid for use in specified state.

    At line:1 char:1

    + add-azureaccount

    + ~~~~~~~~~~~~~~~~

        + CategoryInfo          : CloseError: (:) [Add-AzureAccount], AadAuthenticationFailedException

        + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.AddAzureAccount

    Saturday, October 25, 2014 6:18 PM

Answers

  • I just found a solution!
    You have to delete your profile manually (Clear-AzureProfile will fail as well).
    Remove-Item "$env:USERPROFILE\AppData\Roaming\Windows Azure Powershell"


    • Proposed as answer by StanislawSwierc Wednesday, December 10, 2014 5:03 PM
    • Marked as answer by GSS138 Friday, May 1, 2015 6:10 PM
    Wednesday, December 10, 2014 5:03 PM

All replies

  • I got the same error after migrating local machine account to domain account.

    Add-AzureAccount : Key not valid for use in specified state.
    At line:1 char:1
    + Add-AzureAccount
    + ~~~~~~~~~~~~~~~~
        + CategoryInfo          : CloseError: (:) [Add-AzureAccount], AadAuthenticationFailedException
        + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.AddAzureAccount

    Even re installation of Azure Powershell does not solve issue. 

    Unfortunately I don't have time to debug the issue in azure ps debug build so any help would be greatly appreciated.

    Saturday, November 1, 2014 3:10 PM
  • Hi,

    What is the version of your Azure PowerShell?

    After you typed "add-azureaccount", did it prompt for the sign-in dialog box as below?

    Best regards,

    Susie

    Monday, November 10, 2014 2:32 AM
  • I'm seeing the same issue after I installed the version 0.8.11 of the Microsoft Azure PowerShell

    > Get-Module -Name Azure | Format-List
    Name              : Azure
    Path              : C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1
    Description       :
    ModuleType        : Manifest
    Version           : 0.8.11
    Wednesday, December 10, 2014 3:51 PM
  • I just found a solution!
    You have to delete your profile manually (Clear-AzureProfile will fail as well).
    Remove-Item "$env:USERPROFILE\AppData\Roaming\Windows Azure Powershell"


    • Proposed as answer by StanislawSwierc Wednesday, December 10, 2014 5:03 PM
    • Marked as answer by GSS138 Friday, May 1, 2015 6:10 PM
    Wednesday, December 10, 2014 5:03 PM
  • Thank you I have been using a work around but will give this a try next time.
    Tuesday, December 23, 2014 11:41 PM
  • worked for me, thanks

    El Khiyati

    Friday, January 15, 2016 2:46 PM
  • Works fine, thanks! Don't forget to close and open the PowerShell session again.
    Wednesday, March 9, 2016 11:17 AM