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

52 строки
7.6 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.identity.ManagedIdentityCredential"
fullName: "com.azure.identity.ManagedIdentityCredential"
name: "ManagedIdentityCredential"
nameWithType: "ManagedIdentityCredential"
summary: "[Azure Managed Identity][] is a feature in [Microsoft Entra ID][] that provides a way for applications running on Azure to authenticate themselves with Azure resources without needing to manage or store any secrets like passwords or keys.\n\n\n[Azure Managed Identity]: https://learn.microsoft.com/entra/identity/managed-identities-azure-resources/\n[Microsoft Entra ID]: https://learn.microsoft.com/entra/fundamentals/"
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 final class **ManagedIdentityCredential**</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.ManagedIdentityCredential.getClientId()"
fullName: "com.azure.identity.ManagedIdentityCredential.getClientId()"
name: "getClientId()"
nameWithType: "ManagedIdentityCredential.getClientId()"
summary: "Gets the client ID of user assigned or system assigned identity."
syntax: "public String getClientId()"
desc: "Gets the client ID of user assigned or system assigned identity."
returns:
description: "the client ID of user assigned or system assigned identity."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- uid: "com.azure.identity.ManagedIdentityCredential.getToken(com.azure.core.credential.TokenRequestContext)"
fullName: "com.azure.identity.ManagedIdentityCredential.getToken(TokenRequestContext request)"
name: "getToken(TokenRequestContext request)"
nameWithType: "ManagedIdentityCredential.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;"
type: "class"
desc: "[Azure Managed Identity][] is a feature in [Microsoft Entra ID][] that provides a way for applications running on Azure to authenticate themselves with Azure resources without needing to manage or store any secrets like passwords or keys. The ManagedIdentityCredential authenticates the configured managed identity (system or user assigned) of an Azure resource. So, if the application is running inside an Azure resource that supports Managed Identity through IDENTITY/MSI, IMDS endpoints, or both, then this credential will get your application authenticated, and offers a great secretless authentication experience. For more information refer to the [managed identity authentication documentation][].\n\nThe Managed Identity credential supports managed identity authentication for the following Azure Services:\n\n1. [Azure App Service][]\n2. [Azure Arc][]\n3. [Azure Cloud Shell][]\n4. [Azure Functions][]\n5. [Azure Kubernetes Service][]\n6. [Azure Service Fabric][]\n7. [Azure Virtual Machines][]\n8. [Azure Virtual Machines Scale Sets][]\n\n**Sample: Construct a simple ManagedIdentityCredential**\n\nThe following code sample demonstrates the creation of a ManagedIdentityCredential, using the <xref uid=\"com.azure.identity.ManagedIdentityCredentialBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"com.azure.identity.ManagedIdentityCredentialBuilder\"></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 managedIdentityCredential = new ManagedIdentityCredentialBuilder().build();\n```\n\n**Sample: Construct a User Assigned ManagedIdentityCredential**\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 ManagedIdentityCredential to target a user assigned managed identity, using the <xref uid=\"com.azure.identity.ManagedIdentityCredentialBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"com.azure.identity.ManagedIdentityCredentialBuilder\"></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 managedIdentityCredentialUserAssigned = new ManagedIdentityCredentialBuilder().clientId(\n clientId) // specify client id of user-assigned managed identity.\n .build();\n```\n\n\n[Azure Managed Identity]: https://learn.microsoft.com/entra/identity/managed-identities-azure-resources/\n[Microsoft Entra ID]: https://learn.microsoft.com/entra/fundamentals/\n[managed identity authentication documentation]: https://aka.ms/azsdk/java/identity/managedidentitycredential/docs\n[Azure App Service]: https://learn.microsoft.com/azure/app-service/\n[Azure Arc]: https://learn.microsoft.com/azure/azure-arc/\n[Azure Cloud Shell]: https://learn.microsoft.com/azure/cloud-shell/overview\n[Azure Functions]: https://learn.microsoft.com/azure/azure-functions/\n[Azure Kubernetes Service]: https://learn.microsoft.com/azure/aks/\n[Azure Service Fabric]: https://learn.microsoft.com/azure/service-fabric/\n[Azure Virtual Machines]: https://learn.microsoft.com/azure/virtual-machines/\n[Azure Virtual Machines Scale Sets]: https://learn.microsoft.com/azure/virtual-machine-scale-sets/"
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.14.1