34 строки
7.8 KiB
YAML
34 строки
7.8 KiB
YAML
### YamlMime:JavaType
|
|
uid: "com.azure.identity.DefaultAzureCredential"
|
|
fullName: "com.azure.identity.DefaultAzureCredential"
|
|
name: "DefaultAzureCredential"
|
|
nameWithType: "DefaultAzureCredential"
|
|
summary: "DefaultAzureCredential simplifies authentication while developing apps that deploy to Azure by combining credentials used in Azure hosting environments with credentials used in local development."
|
|
inheritances:
|
|
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
|
|
- "<xref href=\"com.azure.identity.ChainedTokenCredential?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
|
|
inheritedClassMethods:
|
|
- classRef: "<xref href=\"com.azure.identity.ChainedTokenCredential?alt=com.azure.identity.ChainedTokenCredential&text=ChainedTokenCredential\" data-throw-if-not-resolved=\"False\" />"
|
|
methodsRef:
|
|
- "<xref href=\"com.azure.identity.ChainedTokenCredential.getToken(com.azure.core.credential.TokenRequestContext)?alt=com.azure.identity.ChainedTokenCredential.getToken&text=getToken\" data-throw-if-not-resolved=\"False\" />"
|
|
- "<xref href=\"com.azure.identity.ChainedTokenCredential.getTokenSync(com.azure.core.credential.TokenRequestContext)?alt=com.azure.identity.ChainedTokenCredential.getTokenSync&text=getTokenSync\" data-throw-if-not-resolved=\"False\" />"
|
|
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
|
|
methodsRef:
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
|
|
syntax: "public final class **DefaultAzureCredential**</br> extends <xref href=\"com.azure.identity.ChainedTokenCredential?alt=com.azure.identity.ChainedTokenCredential&text=ChainedTokenCredential\" data-throw-if-not-resolved=\"False\" />"
|
|
type: "class"
|
|
desc: "DefaultAzureCredential simplifies authentication while developing apps that deploy to Azure by combining credentials used in Azure hosting environments with credentials used in local development. In production, it's better to use something else. For more information, see [Usage guidance for DefaultAzureCredential][].\n\nAttempts to authenticate with each of these credentials, in the following order, stopping when one provides a token:\n\n1. <xref uid=\"com.azure.identity.EnvironmentCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"EnvironmentCredential\"></xref>\n2. <xref uid=\"com.azure.identity.WorkloadIdentityCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"WorkloadIdentityCredential\"></xref>\n3. <xref uid=\"com.azure.identity.ManagedIdentityCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ManagedIdentityCredential\"></xref>\n4. <xref uid=\"com.azure.identity.SharedTokenCacheCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SharedTokenCacheCredential\"></xref>\n5. <xref uid=\"com.azure.identity.IntelliJCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"IntelliJCredential\"></xref>\n6. <xref uid=\"com.azure.identity.AzureCliCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AzureCliCredential\"></xref>\n7. <xref uid=\"com.azure.identity.AzurePowerShellCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AzurePowerShellCredential\"></xref>\n8. <xref uid=\"com.azure.identity.AzureDeveloperCliCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AzureDeveloperCliCredential\"></xref>\n\nConsult the documentation of these credentials for more information on how they attempt authentication.\n\n## Configure DefaultAzureCredential ##\n\nDefaultAzureCredential supports a set of configurations through setters on the <xref uid=\"com.azure.identity.DefaultAzureCredentialBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"DefaultAzureCredentialBuilder\"></xref> or environment variables.\n\n1. Setting the environment variables `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET/AZURE_CLIENT_CERTIFICATE_PATH`, and `AZURE_TENANT_ID` configures the DefaultAzureCredential to authenticate as the service principal specified by the values.\n2. Setting <xref uid=\"com.azure.identity.DefaultAzureCredentialBuilder.managedIdentityClientId(java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"DefaultAzureCredentialBuilder#managedIdentityClientId(String)\"></xref> on the builder or the environment variable AZURE\\_CLIENT\\_ID configures the DefaultAzureCredential to authenticate as a user-defined managed identity, while leaving them empty configures it to authenticate as a system-assigned managed identity.\n3. Setting <xref uid=\"com.azure.identity.DefaultAzureCredentialBuilder.tenantId(java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"DefaultAzureCredentialBuilder#tenantId(String)\"></xref> on the builder or the environment variable `AZURE_TENANT_ID` configures the DefaultAzureCredential to authenticate to a specific tenant for Visual Studio Code, and IntelliJ IDEA.\n\n**Sample: Construct DefaultAzureCredential**\n\nThe following code sample demonstrates the creation of a DefaultAzureCredential, using the <xref uid=\"com.azure.identity.DefaultAzureCredentialBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"com.azure.identity.DefaultAzureCredentialBuilder\"></xref> to configure it. 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 defaultAzureCredential = new DefaultAzureCredentialBuilder().build();\n```\n\n**Sample: Construct DefaultAzureCredential with User Assigned Managed Identity** \n\nUser-Assigned Managed Identity (UAMI) in Azure is a feature that allows you to create an identity in [Microsoft Entra ID][] that is associated with one or more Azure resources. This identity can then be used to authenticate and authorize access to various Azure services and resources. The following code sample demonstrates the creation of a DefaultAzureCredential to target a user assigned managed identity, using the <xref uid=\"com.azure.identity.DefaultAzureCredentialBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"com.azure.identity.DefaultAzureCredentialBuilder\"></xref> to configure it. 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 dacWithUserAssignedManagedIdentity\n = new DefaultAzureCredentialBuilder().managedIdentityClientId(\"<Managed-Identity-Client-Id\").build();\n```\n\n\n[Usage guidance for DefaultAzureCredential]: https://aka.ms/azsdk/java/identity/credential-chains#usage-guidance-for-defaultazurecredential\n[Microsoft Entra ID]: https://learn.microsoft.com/entra/fundamentals/"
|
|
metadata: {}
|
|
package: "com.azure.identity"
|
|
artifact: com.azure:azure-identity:1.14.1
|