Forum Discussion
How to get rid of warning 'Unable to acquire token for tenant 76a47f06...' with Connect-AzAccount?
How do I get rid of the warning 'WARNING: Unable to acquire token for tenant 76a47f06...' permanently and forever when I log in with 'Connect-AzAccount'?
I have already deleted the file "C:\Users\RContosoUser\.Azure\AzureRmContext.json". No improvement.
I have already logged in with 'Connect-AzAccount --UseDeviceAuthentication'. No improvement.
I also tried 'Clear-AzContext' and 'Remove-AzContext'. No improvement.
When I log in, I always get (partially anonymized here) the following message/warning:
PS C:\Users\RContosoUser> Connect-AzAccount -UseDeviceAuthentication
WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code DSU000000
to authenticate.
WARNING: TenantId 'd4b72ec1' contains more than one active subscription. First one will be
selected for further use. To select another subscription, use Set-AzContext.
WARNING: Unable to acquire token for tenant '76a47f06' with error 'You must use
multi-factor authentication to access tenant 76a47f06, please rerun 'Connect-AzAccount'
with additional parameter '-TenantId 76a47f06'.'
WARNING: Unable to acquire token for tenant '80fab529' with error
'SharedTokenCacheCredential authentication unavailable. Token acquisition failed for user email address removed for privacy reasons.
Ensure that you have authenticated with a developer tool that supports Azure single sign on.'
WARNING: Unable to acquire token for tenant '76a47f06' with error 'You must use
multi-factor authentication to access tenant 76a47f06, please rerun 'Connect-AzAccount'
with additional parameter '-TenantId 76a47f06'.'
WARNING: Unable to acquire token for tenant '80fab529' with error
'SharedTokenCacheCredential authentication unavailable. Token acquisition failed for user email address removed for privacy reasons.
Ensure that you have authenticated with a developer tool that supports Azure single sign on.'
Account SubscriptionName TenantId Environment
------- ---------------- -------- -----------
email address removed for privacy reasons MPN - R ContosoUser d4b72ec1 AzureCloud
I no longer have any access at all to the tenants '76a47f06' and '80fab529' mentioned in the warning. I cannot contact anyone there to remove me from the AAD user directory.
So what can I do to get rid of these warnings?
8 Replies
- Neil_MullinsCopper Contributor
I had the same problem but found out what the issue was for me. I was opening my powershell as administrator, when I don't do that I was able to log on.
- vicmct
Microsoft
Try:
Update-AzConfig -EnableLoginByWam $false
and then:
Connect-AzAccount
- Rob_GoodridgeCopper ContributorYou have multiple tenants so you need to specify -TenantId
- arnaudhelinCopper Contributor
Hi everyone,
I know its an old thread but for user who experienced the same issue, the action i described just after was the only solution which works for me.
Step 1 : Clear all the browser cache you have : Edge, Chrome, etc.
Step 2 : Go to C:\Users\<user>\AppData\Local
Step 3 : Remove the ".IdentityService" folder (Remark : could be hidden)
Reboot and enjoy
Edit 19/09/2024:
Now, i have to change the Az config doing Update-AzConfig -LoginExperienceV2 Off -EnableLoginByWam $false
- LainRobertsonSilver Contributor
Hi, Robert.
All I can offer is some guesswork here since I can't reproduce this issue.
With respect to the Clear-AzContext commandlet, make sure you set -Scope to CurrentUser. For example:
Clear-AzContext -Scope CurrentUser -Force; Disconnect-AzAccount;
Be sure to close the PowerShell session and open a new one after doing this. The following are also useful commandlets for checking current settings:
- Get-AzContext -ListAvailable
- Get-AzContextAutosaveSetting -Scope CurrentUser
Also ensure you're on the latest version. You can read more about some of the version-specific issues below (somewhat dated now but possibly still relevant) - this warning being one of them - that manifested when Microsoft cut over from using the ADAL endpoint to the newer MSAL endpoint.
Cheers,
Lain
- Robert KBrass Contributor
LainRobertson Thanks for the tips. Unfortunately, they did not help. The problem still exists. I think I am also up to date with the AZ.* cmdlets.
Get-Module -ListAvailable AZ.* Verzeichnis: C:\Program Files\WindowsPowerShell\Modules ModuleType Version Name ExportedCommands ---------- ------- ---- ---------------- Script 2.8.0 Az.Accounts {Disable-AzDataCollection, Disable-AzContextAutosave, Enab... Script 1.1.2 Az.Advisor {Get-AzAdvisorRecommendation, Enable-AzAdvisorRecommendati... Script 4.1.0 Az.Aks {Get-AzAksCluster, New-AzAksCluster, Remove-AzAksCluster, ... Script 1.1.4 Az.AnalysisServices {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServic... Script 3.0.0 Az.ApiManagement {Add-AzApiManagementApiToGateway, Add-AzApiManagementApiTo... Script 1.1.0 Az.AppConfiguration {Get-AzAppConfigurationStore, Get-AzAppConfigurationStoreK... Script 2.0.0 Az.ApplicationInsights {Get-AzApplicationInsights, Get-AzApplicationInsightsApiKe... Script 1.0.0 Az.Attestation {New-AzAttestation, Get-AzAttestation, Remove-AzAttestatio... Script 1.7.3 Az.Automation {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHyb... Script 3.2.0 Az.Batch {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAcc... Script 2.0.0 Az.Billing {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollme... Script 2.1.0 Az.Cdn {Clear-AzCdnEndpointContent, Clear-AzFrontDoorCdnEndpointC... Script 1.1.0 Az.CloudService {Get-AzCloudService, Get-AzCloudServiceInstanceView, Get-A... Script 1.11.0 Az.CognitiveServices {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAc... Script 4.27.0 Az.Compute {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAv... Script 3.1.0 Az.ContainerInstance {Add-AzContainerInstanceOutput, Get-AzContainerGroup, Get-... Script 3.0.0 Az.ContainerRegistry {New-AzContainerRegistry, Get-AzContainerRegistry, Update-... Script 1.8.0 Az.CosmosDB {Get-AzCosmosDBSqlContainer, Get-AzCosmosDBSqlContainerThr... Script 1.1.0 Az.DataBoxEdge {Get-AzDataBoxEdgeJob, Get-AzDataBoxEdgeDevice, Invoke-AzD... Script 1.2.0 Az.Databricks {Get-AzDatabricksOutboundNetworkDependenciesEndpoint, Get-... Script 1.16.7 Az.DataFactory {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFa... Script 1.0.2 Az.DataLakeAnalytics {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalytic... Script 1.3.0 Az.DataLakeStore {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeSt... Script 1.0.1 Az.DataShare {New-AzDataShareAccount, Get-AzDataShareAccount, Remove-Az... Script 1.1.0 Az.DeploymentManager {Get-AzDeploymentManagerArtifactSource, New-AzDeploymentMa... Script 3.1.0 Az.DesktopVirtualization {Disconnect-AzWvdUserSession, Expand-AzWvdMsixImage, Get-A... Script 1.0.2 Az.DevTestLabs {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolic... Script 1.1.2 Az.Dns {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRe... Script 1.3.0 Az.EventGrid {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGr... Script 2.0.0 Az.EventHub {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzE... Script 1.9.0 Az.FrontDoor {New-AzFrontDoor, Get-AzFrontDoor, Set-AzFrontDoor, Remove... Script 4.0.3 Az.Functions {Get-AzFunctionApp, Get-AzFunctionAppAvailableLocation, Ge... Script 5.0.1 Az.HDInsight {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wa... Script 2.0.0 Az.HealthcareApis {Get-AzHealthcareApisService, Get-AzHealthcareApisWorkspac... Script 2.7.4 Az.IotHub {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-A... Script 4.5.0 Az.KeyVault {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, ... Script 2.1.0 Az.Kusto {Add-AzKustoClusterLanguageExtension, Add-AzKustoDatabaseP... Script 1.5.0 Az.LogicApp {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccou... Script 1.1.3 Az.MachineLearning {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssocia... Script 1.2.0 Az.Maintenance {Get-AzApplyUpdate, Get-AzConfigurationAssignment, Get-AzM... Script 1.0.0 Az.ManagedServiceIdentity {Get-AzSystemAssignedIdentity, Get-AzUserAssignedIdentity,... Script 3.0.0 Az.ManagedServices {Get-AzManagedServicesAssignment, Get-AzManagedServicesDef... Script 1.0.2 Az.MarketplaceOrdering {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms} Script 1.1.1 Az.Media {Sync-AzMediaServiceStorageKey, Set-AzMediaServiceKey, Get... Script 1.1.2 Az.Migrate {Get-AzMigrateDiscoveredServer, Get-AzMigrateJob, Get-AzMi... Script 3.0.1 Az.Monitor {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile... Script 1.0.0 Az.MySql {Get-AzMySqlConfiguration, Get-AzMySqlConnectionString, Ge... Script 4.17.0 Az.Network {Add-AzApplicationGatewayAuthenticationCertificate, Get-Az... Script 1.1.1 Az.NotificationHubs {Get-AzNotificationHub, Get-AzNotificationHubAuthorization... Script 3.1.0 Az.OperationalInsights {New-AzOperationalInsightsAzureActivityLogDataSource, New-... Script 1.5.0 Az.PolicyInsights {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSu... Script 1.1.0 Az.PostgreSql {Get-AzPostgreSqlConfiguration, Get-AzPostgreSqlConnection... Script 1.1.2 Az.PowerBIEmbedded {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspa... Script 1.0.3 Az.PrivateDns {Get-AzPrivateDnsZone, Remove-AzPrivateDnsZone, Set-AzPriv... Script 5.4.0 Az.RecoveryServices {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServi... Script 1.6.0 Az.RedisCache {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheSchedul... Script 1.0.0 Az.RedisEnterpriseCache {Export-AzRedisEnterpriseCache, Get-AzRedisEnterpriseCache... Script 1.0.3 Az.Relay {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNa... Script 1.1.0 Az.ResourceMover {Add-AzResourceMoverMoveResource, Get-AzResourceMoverMoveC... Script 6.0.0 Az.Resources {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzR... Script 1.3.0 Az.Security {Get-AzSecuritySolution, Get-AzSecuritySolutionsReferenceD... Script 1.1.0 Az.SecurityInsights {Get-AzSentinelAlertRuleAction, New-AzSentinelAlertRuleAct... Script 1.9.0 Az.ServiceBus {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set... Script 3.0.2 Az.ServiceFabric {Add-AzServiceFabricClientCertificate, Add-AzServiceFabric... Script 1.4.1 Az.SignalR {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSig... Script 3.9.0 Az.Sql {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlData... Script 1.1.0 Az.SqlVirtualMachine {New-AzSqlVM, Get-AzSqlVM, Update-AzSqlVM, Remove-AzSqlVM...} Script 1.1.1 Az.StackHCI {Register-AzStackHCI, Unregister-AzStackHCI, Test-AzStackH... Script 4.6.0 Az.Storage {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStor... Script 1.7.0 Az.StorageSync {Invoke-AzStorageSyncCompatibilityCheck, New-AzStorageSync... Script 2.0.0 Az.StreamAnalytics {Get-AzStreamAnalyticsCluster, Get-AzStreamAnalyticsCluste... Script 1.0.0 Az.Support {Get-AzSupportService, Get-AzSupportProblemClassification,... Script 1.4.0 Az.Synapse {Get-AzSynapseSparkJob, Stop-AzSynapseSparkJob, Submit-AzS... Script 1.1.0 Az.TrafficManager {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTraf... Script 2.11.2 Az.Websites {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServ...
- LainRobertsonSilver Contributor
While I don't have any further guesses for resolving the root cause of the issue, does the following version of Connect-AzAccount avoid the symptoms? (i.e. all those warnings)
Connect-AzAccount -SkipContextPopulation
Cheers,
Lain