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

Get-AzKeyVaultSecret: Azure credentials have not been set up or have expired #24942

Closed
katherinejiarufu opened this issue May 16, 2024 · 4 comments
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported needs-team-attention This issue needs attention from Azure service team or SDK team

Comments

@katherinejiarufu
Copy link

Description

when I was trying to run Get-AzKeyVaultSecret, I received the below error message. I tried to re-log in multiple times and use Connect-AzAccount and set my environment but it still gave me the same error. I can't seem to find the correct solution for this online. Can someone help me with this? Thank you!

Get-AzKeyVaultSecret : Your Azure credentials have not been set up or have expired, please run Connect-AzAccount to set up your Azure credentials.A task was canceled.

Issue script & Debug output

DEBUG: 11:14:40 AM - GetAzureKeyVaultSecret begin processing with ParameterSet ''.
DEBUG: 11:14:40 AM - using account id ''...
DEBUG: 11:14:40 AM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: [Common.Authentication]: Authenticating using Account: '', environment: 'AzureCloud', tenant: ''
DEBUG: 11:14:40 AM - [ConfigManager] Got nothing from [DisableInstanceDiscovery], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 11:14:40 AM - [ConfigManager] Got nothing from [EnableLoginByWam], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 11:14:40 AM - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'', Scopes:'', AuthorityHost:'', UserId:''
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ ] ParentRequestId:
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET Framework 4.8.9232.0 Microsoft Windows 10.0.22621  [2024-05-16 18:14:40Z - 9512b42c-4193-44b8-a003-a7c42296f3a4] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET Framework 4.8.9232.0 Microsoft Windows 10.0.22621  [2024-05-16 18:14:40Z - 9512b42c-4193-44b8-a003-a7c42296f3a4] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET Framework 4.8.9232.0 Microsoft Windows 10.0.22621  [2024-05-16 18:14:40Z - 9512b42c-4193-44b8-a003-a7c42296f3a4] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET Framework 4.8.9232.0 Microsoft Windows 10.0.22621  [2024-05-16 18:14:40Z - 9512b42c-4193-44b8-a003-a7c42296f3a4] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET Framework 4.8.9232.0 Microsoft Windows 10.0.22621  [2024-05-16 18:14:40Z - 9512b42c-4193-44b8-a003-a7c42296f3a4] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET Framework 4.8.9232.0 Microsoft Windows 10.0.22621  [2024-05-16 18:14:40Z - 9512b42c-4193-44b8-a003-a7c42296f3a4] IsLegacyAdalCacheEnabled: yes

IsSuccess: False; Duration: 00:00:00.0780720; Exception: Your Azure credentials have not been set up or have expired, please run Connect-AzAccount to set up your Azure credentials.
SharedTokenCacheCredential authentication unavailable. Token acquisition failed for user "". Ensure that you have authenticated with a developer tool that supports Azure single sign on.;
DEBUG: 11:14:40 AM - GetAzureKeyVaultSecret end processing.

Environment data

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

Module versions

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     2.17.0     Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault...}
Script     5.2.2      Az.KeyVault                         {Add-AzKeyVaultCertificate, Add-AzKeyVaultCertificateContact, Add-AzKeyVaultKey, Add-AzKeyVaultManagedStorageAccount...}

Error output

No response

@katherinejiarufu katherinejiarufu added bug This issue requires a change to an existing behavior in the product in order to be resolved. needs-triage This is a new issue that needs to be triaged to the appropriate team. labels May 16, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported needs-triage This is a new issue that needs to be triaged to the appropriate team. and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels May 16, 2024
@Fiewor
Copy link

Fiewor commented May 22, 2024

were you able to resolve this?

i have a similar issue:

New-AzResourceGroup: Your Azure credentials have not been set up or have expired, please run Connect-AzAccount to set up your Azure credentials.
Authentication failed against tenant 4058a0b6-1d47-4fcd-990d-c1e88e62d0d1. 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 4058a0b6-1d47-4fcd-990d-c1e88e62d0d1'.

i tried the suggested fix, but to no avail.

@isra-fel
Copy link
Member

@katherinejiarufu thanks for reporting but could you share the stack trace? Reproduce the issue then run Resolve-AzError.
@Fiewor which version of Az.Accounts did you use? If 3.0.0, please try Set-AzConfig -EnableLoginByWam.

@isra-fel isra-fel added needs-author-feedback More information is needed from author to address the issue. and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels May 27, 2024
@Fiewor
Copy link

Fiewor commented May 29, 2024

Set-AzConfig -EnableLoginByWam

Thanks. I was indeed on version 3.0.0 and running Set-AzConfig -EnableLoginByWam $true helped resolve my issue.

@katherinejiarufu
Copy link
Author

Set-AzConfig -EnableLoginByWam $true worked for me too!

@microsoft-github-policy-service microsoft-github-policy-service bot added needs-team-attention This issue needs attention from Azure service team or SDK team and removed needs-author-feedback More information is needed from author to address the issue. labels May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported needs-team-attention This issue needs attention from Azure service team or SDK team
Projects
None yet
Development

No branches or pull requests

3 participants