Azure / Azure/azure-powershell

Connect-AzAccount Failing on VMs During Az Module Migration

Open
#28,287 2 comments 0 reactions 0 assignees View on GitHub
Authentication Azure PS Team needs-team-attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

. While testing the Connect-AzAccount command, I’m encountering the following error:
Connect-AzAccount : UsernamePasswordCredential authentication failed: Persistence check failed.
This issue is only occurring on virtual machines (VMs) — the same command executes successfully on physical devices.

A few another specific questions I have:
• What logs should I collect to assist with troubleshooting?
• Is there any supported documentation or known guidance for this issue?

### Issue script & Debug output

```PowerShell
PS C:\Users\EdgeSupport\Documents> Connect-AzAccount -EnvironmentName AzDBE -TenantId $ten -Credential ([pscredential]::new('$user',(ConvertTo-SecureString $password -AsPlainText -Force))) -Verbose
VERBOSE: Performing the operation "log in" on target "User account in environment 'AzDBE'".
Connect-AzAccount : UsernamePasswordCredential authentication failed: Persistence check failed. Inspect inner
exception for details
At line:1 char:1
+ Connect-AzAccount -EnvironmentName AzDBE -TenantId ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Connect-AzAccount], AuthenticationFailedException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand
```

### Environment data

```PowerShell
C:\Users\Administrator\Documents> $PSVersionTable

Name Value
---- -----
PSVersion 5.1.20348.2849
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.2849
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```

### Module versions

```PowerShell
PS C:\Users\Administrator\Documents> Get-Module -Name Az* -ListAvailable

Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 2.2.8 Az.Accounts {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-Az...
Script 0.11.0 Az.Billing Get-UsageAggregates
Script 3.3.0 Az.Compute {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailab...
Script 1.1.0 Az.DataBoxEdge {Get-AzDataBoxEdgeJob, Get-AzDataBoxEdgeDevice, Invoke-AzDataBo...
Script 0.11.0 Az.Dns {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRecordS...
Script 1.4.3 Az.EventHub {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzEventH...
Script 0.11.0 Az.IotHub {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-AzIotH...
Script 0.11.0 Az.KeyVault {Add-AzKeyVaultCertificate, Set-AzKeyVaultCertificateAttribute,...
Script 1.6.0 Az.Monitor {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get...
Script 1.2.2 Az.Network {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzAppli...
Script 0.12.0 Az.Resources {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAs...
Script 0.11.0 Az.Resources {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAs...
Script 2.6.2 Az.Storage {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAc...
Script 0.11.0 Az.Websites {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePl...
Script 1.0.2 Azs.Azurebridge.Admin {Get-AzsAzureBridgeActivation, Get-AzsAzureBridgeDownloadedProd...
Script 1.0.2 Azs.Backup.Admin {Get-AzsBackup, Get-AzsBackupConfiguration, Invoke-AzsPruneBack...
Script 1.0.2 Azs.Commerce.Admin Get-AzsSubscriberUsage
Script 1.2.0 Azs.Compute.Admin {Add-AzsPlatformImage, Add-AzsVMExtension, Disable-AzsComputeUs...
Script 0.2.0 Azs.ContainerRegistry.Admin {Get-AzsContainerRegistry, Get-AzsContainerRegistryCapacity, Ge...
Script 0.1.0 Azs.ContainerService.Admin {Get-AzsContainerService, Get-AzsContainerServiceQuota}
Script 1.0.1 Azs.Deployment.Admin {Set-AzsProductSecret, IsRetryableError, IsOperationResultTermi...
Script 1.0.2 Azs.Fabric.Admin {Add-AzsScaleUnitNode, Disable-AzsScaleUnitNode, Enable-AzsScal...
Script 1.0.2 Azs.Gallery.Admin {Add-AzsGalleryItem, Get-AzsGalleryItem, Remove-AzsGalleryItem}
Script 1.0.2 Azs.Infrastructureinsights.Admin {Close-AzsAlert, Get-AzsAlert, Get-AzsRegionHealth, Get-AzsRegi...
Script 1.0.2 Azs.Keyvault.Admin Get-AzsKeyvaultQuota
Script 1.1.0 Azs.Network.Admin {Get-AzsLoadBalancer, Get-AzsNetworkAdminOverview, Get-AzsNetwo...
Script 1.0.2 Azs.Storage.Admin {Get-AzsStorageAccount, Get-AzsStorageAcquisition, Get-AzsStora...
Script 1.0.2 Azs.Subscriptions {Get-AzsDelegatedProviderOffer, Get-AzsOffer, Get-AzsSubscripti...
Script 1.0.2 Azs.Subscriptions.Admin {Add-AzsPlanToOffer, Get-AzsAcquiredPlan, Get-AzsAdminManagedOf...
Manifest 0.1.161 Azs.Syndication.Admin {Select-AzsMarketplaceItem, Export-AzsMarketplaceItem, Import-A...
Script 1.1.0 Azs.Update.Admin {Get-AzsUpdate, Get-AzsUpdateLocation, Get-AzsUpdateRun, Instal...
Manifest 2.4.0 AzureStack
```

### Error output

```PowerShell
Resolve-AzError
The term 'Resolve-AzError' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
+ CategoryInfo : ObjectNotFound: (Resolve-AzError:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
```

Contributor guide

Open the contributing guide

Research direction

Start with the Connect-AzAccount command and the supplied PowerShell 5.1, Az.Accounts 2.2.8, VM, and physical-device conditions. Reproduce the failure and inspect the verbose output and inner exception; Resolve-AzError is unavailable in the reported environment. Done means identifying the VM-specific cause and documenting the logs or supported guidance needed to troubleshoot it.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell
Domain
authentication, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.