azure-docs-sdk-java/docs-ref-autogen/com.azure.identity.Workload...

52 строки
6.2 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.identity.WorkloadIdentityCredential"
fullName: "com.azure.identity.WorkloadIdentityCredential"
name: "WorkloadIdentityCredential"
nameWithType: "WorkloadIdentityCredential"
summary: "Workload Identity authentication is a feature in Azure that allows applications running on virtual machines (VMs) to access other Azure resources without the need for a service principal or managed identity."
inheritances:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- 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 class **WorkloadIdentityCredential**</br> implements <xref href=\"com.azure.core.credential.TokenCredential?alt=com.azure.core.credential.TokenCredential&text=TokenCredential\" data-throw-if-not-resolved=\"False\" />"
methods:
- uid: "com.azure.identity.WorkloadIdentityCredential.getToken(com.azure.core.credential.TokenRequestContext)"
fullName: "com.azure.identity.WorkloadIdentityCredential.getToken(TokenRequestContext request)"
name: "getToken(TokenRequestContext request)"
nameWithType: "WorkloadIdentityCredential.getToken(TokenRequestContext request)"
parameters:
- name: "request"
type: "<xref href=\"com.azure.core.credential.TokenRequestContext?alt=com.azure.core.credential.TokenRequestContext&text=TokenRequestContext\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<AccessToken> getToken(TokenRequestContext request)"
returns:
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<xref href=\"com.azure.core.credential.AccessToken?alt=com.azure.core.credential.AccessToken&text=AccessToken\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.identity.WorkloadIdentityCredential.getTokenSync(com.azure.core.credential.TokenRequestContext)"
fullName: "com.azure.identity.WorkloadIdentityCredential.getTokenSync(TokenRequestContext request)"
name: "getTokenSync(TokenRequestContext request)"
nameWithType: "WorkloadIdentityCredential.getTokenSync(TokenRequestContext request)"
parameters:
- name: "request"
type: "<xref href=\"com.azure.core.credential.TokenRequestContext?alt=com.azure.core.credential.TokenRequestContext&text=TokenRequestContext\" data-throw-if-not-resolved=\"False\" />"
syntax: "public AccessToken getTokenSync(TokenRequestContext request)"
returns:
type: "<xref href=\"com.azure.core.credential.AccessToken?alt=com.azure.core.credential.AccessToken&text=AccessToken\" data-throw-if-not-resolved=\"False\" />"
type: "class"
desc: "Workload Identity authentication is a feature in Azure that allows applications running on virtual machines (VMs) to access other Azure resources without the need for a service principal or managed identity. With Workload Identity authentication, applications authenticate themselves using their own identity, rather than using a shared service principal or managed identity. Under the hood, Workload Identity authentication uses the concept of Service Account Credentials (SACs), which are automatically created by Azure and stored securely in the VM. By using Workload Identity authentication, you can avoid the need to manage and rotate service principals or managed identities for each application on each VM. Additionally, because SACs are created automatically and managed by Azure, you don't need to worry about storing and securing sensitive credentials themselves. The WorkloadIdentityCredential supports Azure workload identity authentication on Azure Kubernetes and acquires a token using the service account credentials available in the Azure Kubernetes environment. Refer to [Microsoft Entra Workload ID][] for more information.\n\n**Sample: Construct WorkloadIdentityCredential**\n\nThe following code sample demonstrates the creation of a <xref uid=\"com.azure.identity.WorkloadIdentityCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"WorkloadIdentityCredential\"></xref>, using the <xref uid=\"com.azure.identity.WorkloadIdentityCredentialBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"WorkloadIdentityCredentialBuilder\"></xref> to configure it. The `clientId`, is required to create <xref uid=\"com.azure.identity.WorkloadIdentityCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"WorkloadIdentityCredential\"></xref>. 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 workloadIdentityCredential = new WorkloadIdentityCredentialBuilder()\n .clientId(\"<clientID>\")\n .tenantId(\"<tenantID>\")\n .tokenFilePath(\"<token-file-path>\")\n .build();\n```\n\n\n[Microsoft Entra Workload ID]: https://learn.microsoft.com/azure/aks/workload-identity-overview"
implements:
- "<xref href=\"com.azure.core.credential.TokenCredential?alt=com.azure.core.credential.TokenCredential&text=TokenCredential\" data-throw-if-not-resolved=\"False\" />"
metadata: {}
package: "com.azure.identity"
artifact: com.azure:azure-identity:1.13.3