다음을 통해 로컬 컴퓨터에서 Key Vault에 액세스하려고하면 다음 오류가 발생합니다.
DefaultAzureCredential()
다음 두 줄을 실행하고 있지만 계속 오류가 발생합니다.
client = SecretClient(vault_url=<URL>, credential=DefaultAzureCredential())
secret = client.get_secret(<SECRET NAME>).value
azure.core.exceptions.ClientAuthenticationError: DefaultAzureCredential failed to retrieve a token from the included credentials.
Attempted credentials:
EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured.
ManagedIdentityCredential: ManagedIdentityCredential authentication unavailable, no managed identity endpoint found.
SharedTokenCacheCredential: SharedTokenCacheCredential authentication unavailable. No accounts were found in the cache.
VisualStudioCodeCredential: Azure Active Directory error '(invalid_grant) AADSTS700082: The refresh token has expired due to inactivity. The token was issued on 2020-06-07T03:58:48.4708462Z and was inactive for 90.00:00:00.
Azure에 로그인을 시도했지만 az login
자격 증명을 새로 고치지 않습니다.
편집 : 문서 에서 찾은 몇 가지 다른 구성을 시도했습니다 . 이상하게 보이는 것은 기본 자격 증명으로 처리되는 시나리오 중 하나 인 것처럼 보이므로 Azure CLI 자격 증명이 작동한다는 것입니다.
az login
Key Vault에 액세스 하는 데 사용 하는 경우 AzureCliCredential()
및 둘 다 DefaultAzureCredential()
이론적으로 잘 작동합니다. 그러나 오류는 문제의 VisualStudioCodeCredential ()에 표시됩니다.
VisualStudioCodeCredential : 사용자가 Visual Studio Code Azure 계정 확장에 로그인 한 경우 DefaultAzureCredential은 해당 사용자로 인증됩니다.
DefaultAzureCredential
이 순서대로 다음 메커니즘을 통해 인증을 시도하고 성공하면 중지됩니다.
따라서 VisualStudioCode를 건너 뛰도록 사용 AzureCliCredential()
하거나 설정 해야합니다 exclude_visual_studio_code_credential=true
.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다