### YamlMime:JavaType uid: "com.azure.identity.ChainedTokenCredentialBuilder" fullName: "com.azure.identity.ChainedTokenCredentialBuilder" name: "ChainedTokenCredentialBuilder" nameWithType: "ChainedTokenCredentialBuilder" summary: "Fluent credential builder for instantiating a ." inheritances: - "" inheritedClassMethods: - classRef: "java.lang.Object" methodsRef: - "clone" - "equals" - "finalize" - "getClass" - "hashCode" - "notify" - "notifyAll" - "toString" - "wait" - "wait" - "wait" syntax: "public class **ChainedTokenCredentialBuilder**" constructors: - uid: "com.azure.identity.ChainedTokenCredentialBuilder.ChainedTokenCredentialBuilder()" fullName: "com.azure.identity.ChainedTokenCredentialBuilder.ChainedTokenCredentialBuilder()" name: "ChainedTokenCredentialBuilder()" nameWithType: "ChainedTokenCredentialBuilder.ChainedTokenCredentialBuilder()" summary: "Creates an instance of the builder to config the credential." syntax: "public ChainedTokenCredentialBuilder()" desc: "Creates an instance of the builder to config the credential." methods: - uid: "com.azure.identity.ChainedTokenCredentialBuilder.addAll(java.util.Collection)" fullName: "com.azure.identity.ChainedTokenCredentialBuilder.addAll(Collection credentials)" name: "addAll(Collection credentials)" nameWithType: "ChainedTokenCredentialBuilder.addAll(Collection credentials)" summary: "Adds all of the credentials in the specified collection at the end of this chain, as if by calling on each one, in the order that they are returned by the collection's iterator." parameters: - description: "the collection of credentials to be appended to the chain." name: "credentials" type: "Collection<>" syntax: "public ChainedTokenCredentialBuilder addAll(Collection credentials)" desc: "Adds all of the credentials in the specified collection at the end of this chain, as if by calling on each one, in the order that they are returned by the collection's iterator." returns: description: "An updated instance of the builder." type: "" - uid: "com.azure.identity.ChainedTokenCredentialBuilder.addFirst(com.azure.core.credential.TokenCredential)" fullName: "com.azure.identity.ChainedTokenCredentialBuilder.addFirst(TokenCredential credential)" name: "addFirst(TokenCredential credential)" nameWithType: "ChainedTokenCredentialBuilder.addFirst(TokenCredential credential)" summary: "Adds a credential to try to authenticate at the front of the chain." parameters: - description: "the credential to be added to the front of chain" name: "credential" type: "" syntax: "public ChainedTokenCredentialBuilder addFirst(TokenCredential credential)" desc: "Adds a credential to try to authenticate at the front of the chain." returns: description: "the ChainedTokenCredential itself" type: "" - uid: "com.azure.identity.ChainedTokenCredentialBuilder.addLast(com.azure.core.credential.TokenCredential)" fullName: "com.azure.identity.ChainedTokenCredentialBuilder.addLast(TokenCredential credential)" name: "addLast(TokenCredential credential)" nameWithType: "ChainedTokenCredentialBuilder.addLast(TokenCredential credential)" summary: "Adds a credential to try to authenticate at the last of the chain." parameters: - description: "the credential to be added to the end of chain" name: "credential" type: "" syntax: "public ChainedTokenCredentialBuilder addLast(TokenCredential credential)" desc: "Adds a credential to try to authenticate at the last of the chain." returns: description: "the ChainedTokenCredential itself" type: "" - uid: "com.azure.identity.ChainedTokenCredentialBuilder.build()" fullName: "com.azure.identity.ChainedTokenCredentialBuilder.build()" name: "build()" nameWithType: "ChainedTokenCredentialBuilder.build()" summary: "Creates a new with the current configurations." syntax: "public ChainedTokenCredential build()" desc: "Creates a new with the current configurations." returns: description: "a with the current configurations." type: "" type: "class" desc: "Fluent credential builder for instantiating a . The is a convenience credential that allows users to chain together a set of TokenCredential together. The credential executes each credential in the chain sequentially and returns the token from the first credential in the chain that successfully authenticates.\n\n**Sample: Construct a ChainedTokenCredential.**\n\nThe following code sample demonstrates the creation of a , using the to configure it. The sample below tries silent username+password login tried first, then interactive browser login as needed (e.g. when 2FA is turned on in the directory). Once this credential is created, it may be passed into the builder of many of the Azure SDK for Java client builders as the 'credential' parameter.\n\n```java\nTokenCredential usernamePasswordCredential = new UsernamePasswordCredentialBuilder()\n .clientId(clientId)\n .username(fakeUsernamePlaceholder)\n .password(fakePasswordPlaceholder)\n .build();\n TokenCredential interactiveBrowserCredential = new InteractiveBrowserCredentialBuilder()\n .clientId(clientId)\n .port(8765)\n .build();\n TokenCredential credential = new ChainedTokenCredentialBuilder()\n .addLast(usernamePasswordCredential)\n .addLast(interactiveBrowserCredential)\n .build();\n```" metadata: {} package: "com.azure.identity" artifact: com.azure:azure-identity:1.13.3