Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.3k stars 1.96k forks source link

[BUG] IntelliJAuthMethodDetails fail on unknown properties #22449

Closed jianghaolu closed 3 years ago

jianghaolu commented 3 years ago

Describe the bug The object mapper is not configured to allow unknown properties: https://github.com/Azure/azure-sdk-for-java/blob/3f31d68eed6fbe11516ca3afe3955c8840a6e974/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IntelliJCacheAccessor.java#L255

Error: 2021-06-22 10:30:26.364 ERROR c.azure.identity.IntelliJCredential , - Azure Identity => ERROR in getToken() call for scopes [https://rsp1euwniptuckd1.blob.core.windows.net/.default]: Unrecognized field "tenantId" (class com.azure.identity.implementation.IntelliJAuthMethodDetails), not marked as ignorable (4 known properties: "authMethod", "azureEnv", "accountEmail", "credFilePath"]) at [Source: (File); line: 1, column: 52] (through reference chain: com.azure.identity.implementation.IntelliJAuthMethodDetails["tenantId"])

To Reproduce Steps to reproduce the behavior:

DefaultAzureCredential defaultCredential = new DefaultAzureCredentialBuilder()
         .managedIdentityClientId(clientId)
         .intelliJKeePassDatabasePath("C:\\Users\\sanata\\AppData\\Roaming\\JetBrains\\IdeaIC2021.1\\c.kdbx")
         .tenantId("72f988bf-86f1-41af-91ab-2d7cd011db47")
         .build();

Setup (please complete the following information): IntelliJ IDEA 2021.1.1 (Community Edition) Build #IC-211.7142.45, built on April 30, 2021 Runtime version: 11.0.10+9-b1341.41 amd64 VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o. Windows 10 10.0 GC: G1 Young Generation, G1 Old Generation Memory: 4096M Cores: 8 Registry: ide.background.tasks=false Non-Bundled Plugins: com.dmarcotte.handlebars (211.6693.44), com.jetbrains.nim (1.4.0-203), com.jetbrains.plugins.ini4idea (211.6693.44), in.xiv.cs (0.1), com.microsoft.tooling.msservices.intellij.azure (3.53.0-2021.1), PythonCore (211.7142.45) Kotlin: 211-1.4.32-release-IJ7142.27

MauriceReeves-usds commented 3 years ago

We've encountered this bug as well. Previously working code is now failing for tenantId. This is happening on the command line when we attempt to run our app using the DefaultAzureCredentialBuilder

Screen Shot 2021-06-23 at 8 59 54 AM

Setup: IntelliJ IDEA 2021.1.2 (Ultimate Edition) Build #IU-211.7442.40, built on May 31, 2021 Runtime version: 11.0.11+9-b1341.57 x86_64 VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o. macOS 11.4 GC: G1 Young Generation, G1 Old Generation Memory: 1500M Cores: 16 Registry: ide.background.tasks=false, ide.balloon.shadow.size=0 Non-Bundled Plugins: com.intellij.lang.liquid (211.6693.44), com.mallowigi (36.0), net.seesharpsoft.intellij.plugins.csv (2.17.0), org.intellij.plugins.hcl (0.7.10), org.jetbrains.kotlin (211-1.5.0-release-759-IJ6693.72), intellij.ktor (1.5.5), com.nbadal.ktlint (0.7.6), com.chrisrm.idea.MaterialThemeUI (6.6.0), com.microsoft.tooling.msservices.intellij.azure (3.53.0-2021.1), Pythonid (211.7442.45) Kotlin: 211-1.5.0-release-759-IJ6693.72

If I log in via the Azure tools in Intellij, I don't encounter this error, only on using the AzureDefaultCredentialBuilder.

joshfree commented 3 years ago

Duplicate of https://github.com/Azure/azure-sdk-for-java/issues/22429 /cc @g2vinay