question

ruchi-0139 avatar image
0 Votes"
ruchi-0139 asked SatishBoddu-MSFT action

Azure Remote Rendering : Connect-AzAccount with PowerShell

When I try Connect-AzAccount on PowerShell, it shows "Unable to acquire token for tenant 'xxxxxxxxx'"

so I tried "Clear-AzContext", but it shows "Unable to acquire token for tenant 'xxxxxxxxx'" and Unable to set default context 'Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureContext'.

I can't connect finely...

azure-ad-tenant
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @ruchi-0139 Thanks for reaching out to us!Community SME's on this topic or our team will review your scenario and circle back at the possible earliest time.
Do you have more than 1 subscriptions?
Have you tried : Set the subscription context before running Connect-AzAccount

 PS C:\>Set-AzContext -Subscription "xxxx-xxxx-xxxx-xxxx"



0 Votes 0 ·

Yes,I already tried it.

When I type Set-AzContext -Subscription "xxxx-xxxx-xxxx-xxxx"(xxxx-xxxx-xxxx-xxxx is my subscription ID on https://portal.azure.com/),
It shows some errors "Unable to acquire token for tenant 'organizations'.87517-1618381617998.jpg


0 Votes 0 ·
1618381617998.jpg (121.8 KiB)

I also tried the following. Here is more information.

PS C:\> get-azcontext -listavailable

Name Account SubscriptionName Environment TenantId


Default <MY_EMAIL> AzureCloud

<MY_EMAIL> is my e-mail address.

0 Votes 0 ·

1 Answer

SatishBoddu-MSFT avatar image
0 Votes"
SatishBoddu-MSFT answered ruchi-0139 commented

Hello @ruchi-0139

Option 1: ref link
1. Close all PS sessions.
2. Navigate to C:\Users\usernameAlias\ .Azure
3. Rename "AzureRmContext.json" to AzureRmContextOld
4. Open a new session.



Option 2
Connect-AzAccount -UseDeviceAuthentication


Option 3:
update of Azure module

Please refer to this link: When i am trying to connect to my azure portal through powershell iam getting the error: WARNING: Unable to acquire token for tenant

If the response is helpful, please click "Accept Answer" and upvote it. So that it is helpful to others as well.



· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hmm, I have been read it, and I tried renaming AzureRmContext.json 2days ago.
And I tried these options(2-3) already 2-3days ago.

I have tried these again, but it shows same erros.

What is wrong??87925-rapture-20210415053249.png



Picture[1] is evidence.


0 Votes 0 ·

Have you tried from a different laptop?

0 Votes 0 ·

Thank you for supporting me.
No, I have not.
OK, I will try another laptop until 19APR.

I will message you again.

0 Votes 0 ·

I tried using another laptop, but it shows same errors.

0 Votes 0 ·