Hello Microsoft Community,
I am currently preparing for the AZ-104: Microsoft Azure Administrator exam and following the Microsoft Learn exercise “Exercise – Create and deploy an Azure Resource Manager template.” I am completing the exercise using Visual Studio Code and Azure PowerShell.
As instructed in the exercise, I created and saved the ARM template JSON file and then ran the following command in the Visual Studio Code terminal:
Connect-AzAccount
The command opens the browser, and I am able to enter my Microsoft account credentials successfully. However, after authentication, instead of displaying the list of Azure subscriptions in the terminal as described in the exercise, I receive the following error:
Retrieving subscriptions for the selection...
WARNING: Unable to acquire token for tenant '85ca6447-617f-49ac-845d-d3e4ee3fefbc' with error 'Authentication failed
against tenant 85ca6447-617f-49ac-845d-d3e4ee3fefbc. User interaction is required. This may be due to the conditional
access policy settings such as multi-factor authentication (MFA). If you need to access subscriptions in
that tenant, please rerun 'Connect-AzAccount' with additional parameter '-TenantId 85ca6447-617f-49ac-845d-d3e4ee3fefbc'.'
WARNING: Unable to acquire token for tenant 'organizations' with 'SharedTokenCacheCredential authentication failed: '
WARNING: Please run 'Connect-AzAccount -DeviceCode' if browser is not supported in this session.
Connect-AzAccount : SharedTokenCacheCredential authentication failed:
At line:1 char:1
+ Connect-AzAccount
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Connect-AzAccount], AuthenticationFailedException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand
Expected result
According to the Microsoft Learn exercise, after signing in, I should see a list of the subscriptions associated with my account in the Visual Studio Code terminal, with my default subscription marked with an asterisk (*).
Actual result
Authentication appears to complete successfully in the browser, but Azure PowerShell cannot retrieve my subscriptions and returns the authentication error shown above.
Environment
- Exam: AZ-104 Microsoft Azure Administrator
- Exercise: Create and deploy an Azure Resource Manager template
- Operating system: Windows
- IDE: Visual Studio Code
- Shell: PowerShell
- Command:
Connect-AzAccount
- Authentication: Microsoft account with MFA enabled
- Azure: I have an Azure subscription associated with the account
Question
Could someone please advise what is causing this authentication issue and the recommended way to resolve it?
In particular, should I:
- Run
Connect-AzAccount -TenantId <tenant-id> as suggested by the error?
- Use
Connect-AzAccount -DeviceCode instead?
- Check or update any Azure/Entra ID Conditional Access or MFA settings?
- Use another authentication method for completing this Microsoft Learn AZ-104 exercise?
I would appreciate any guidance on the correct approach, particularly one that follows the Microsoft Learn exercise and does not cause issues with my Azure subscription or tenant configuration.
Thank you.Hello Microsoft Community,
I am currently preparing for the AZ-104: Microsoft Azure Administrator exam and following the Microsoft Learn exercise “Exercise – Create and deploy an Azure Resource Manager template.” I am completing the exercise using Visual Studio Code and Azure PowerShell.
As instructed in the exercise, I created and saved the ARM template JSON file and then ran the following command in the Visual Studio Code terminal:
Connect-AzAccount
The command opens the browser, and I am able to enter my Microsoft account credentials successfully. However, after authentication, instead of displaying the list of Azure subscriptions in the terminal as described in the exercise, I receive the following error:
Retrieving subscriptions for the selection...
WARNING: Unable to acquire token for tenant '85ca6447-617f-49ac-845d-d3e4ee3fefbc' with error 'Authentication failed
against tenant 85ca6447-617f-49ac-845d-d3e4ee3fefbc. User interaction is required. This may be due to the conditional
access policy settings such as multi-factor authentication (MFA). If you need to access subscriptions in
that tenant, please rerun 'Connect-AzAccount' with additional parameter '-TenantId 85ca6447-617f-49ac-845d-d3e4ee3fefbc'.'
WARNING: Unable to acquire token for tenant 'organizations' with 'SharedTokenCacheCredential authentication failed: '
WARNING: Please run 'Connect-AzAccount -DeviceCode' if browser is not supported in this session.
Connect-AzAccount : SharedTokenCacheCredential authentication failed:
At line:1 char:1
+ Connect-AzAccount
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:)
Expected result
According to the Microsoft Learn exercise, after signing in, I should see a list of the subscriptions associated with my account in the Visual Studio Code terminal, with my default subscription marked with an asterisk (*).
Actual result
Authentication appears to complete successfully in the browser, but Azure PowerShell cannot retrieve my subscriptions and returns the authentication error shown above.
Environment
- Exam: AZ-104 Microsoft Azure Administrator
- Exercise: Create and deploy an Azure Resource Manager template
- Operating system: Windows
- IDE: Visual Studio Code
- Shell: PowerShell
- Command:
Connect-AzAccount
- Authentication: Microsoft account with MFA enabled
- Azure: I have an Azure subscription associated with the account
Question
Could someone please advise what is causing this authentication issue and the recommended way to resolve it?
In particular, should I:
- Run
Connect-AzAccount -TenantId <tenant-id> as suggested by the error?
- Use
Connect-AzAccount -DeviceCode instead?
- Check or update any Azure/Entra ID Conditional Access or MFA settings?
- Use another authentication method for completing this Microsoft Learn AZ-104 exercise?
I would appreciate any guidance on the correct approach, particularly one that follows the Microsoft Learn exercise and does not cause issues with my Azure subscription or tenant configuration.
Thank you.