Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect-azAccount is not working and I still see things like AzurerRm.Profile in my scripts #135

Open
Blueposey opened this issue Jan 25, 2024 · 2 comments

Comments

@Blueposey
Copy link

when I do Connect-AzAccount
I get: Warning Unable to acquire token for tenant 'organizations with error Exception has been thrown by the target of an invocation
Connect-azAccount : Exception has been thrown by the target of the invocation
at line:1 Char:1
Connect-AzAccount
category Info : CloseError (:) [Connect-AzAccount, TartetInvocationException
FullyQualifiedErrorId: Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand

Component*
[] Az.resources 6.14.0

Environment
windows 11 I am running Powershell ISE as Administrator

Error output
Warning Unable to acquire token for tenant 'organizations with error Exception has been thrown by the target of an invocation
Connect-azAccount : Exception has been thrown by the target of the invocation
at line:1 Char:1
Connect-AzAccount
category Info : CloseError (:) [Connect-AzAccount, TartetInvocationException
FullyQualifiedErrorId: Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand

Additional context
I originally had AzureRm installed and upgraded it to azureRm 6.13.3
per the tool migration instructions
I ran my scripts and they all worked
I uninstalled AzureRm and Installed Azure Az ran the migration tool
Everything says it converted successfully without issue.

but when I ran my scripts I got some errors. I still see things like AzureRm.Profile in my scripts even though I ran the migrate tool and I thought those items would have been updated?
I tried just doing Connect-AzAccount to see if I could connect and I do get a pop up to select my azure account but after that I get the above error.
I can't send a bunch of logs from my work computer but I am wondering if everything with AzureRm should have been converted by the tool in my scripts and how can I connect?
I tried doing the Update-Module Az.* but still can not login.
Please help!


@isra-fel
Copy link
Member

isra-fel commented Feb 2, 2024

@Blueposey Hi, thanks for the feedback. Module names are not in the scope of the conversion today. But you can simply replace AzureRm.Profile with Az.Accounts.

@isra-fel
Copy link
Member

isra-fel commented Feb 2, 2024

Regarding the error of Connect-AzAccount the error message itself doesn't tell us much. Best if you could provide the full debug log (remove any sensitive info before posting).
Other things to try:

  1. Run Get-Module Az* -ListAvailable to double check you have uninstalled azurerm and installed az only
  2. Run Clear-AzContext -Force to clean up token cache
  3. Run it in PowerShell 7 instead of Windows PowerShell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants