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

52 строки
5.9 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.identity.AzureCliCredential"
fullName: "com.azure.identity.AzureCliCredential"
name: "AzureCliCredential"
nameWithType: "AzureCliCredential"
summary: "The Azure CLI is a command-line tool that allows users to manage Azure resources from their local machine or terminal."
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 **AzureCliCredential**</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.AzureCliCredential.getToken(com.azure.core.credential.TokenRequestContext)"
fullName: "com.azure.identity.AzureCliCredential.getToken(TokenRequestContext request)"
name: "getToken(TokenRequestContext request)"
nameWithType: "AzureCliCredential.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.AzureCliCredential.getTokenSync(com.azure.core.credential.TokenRequestContext)"
fullName: "com.azure.identity.AzureCliCredential.getTokenSync(TokenRequestContext request)"
name: "getTokenSync(TokenRequestContext request)"
nameWithType: "AzureCliCredential.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: "The Azure CLI is a command-line tool that allows users to manage Azure resources from their local machine or terminal. It allows users to [authenticate interactively][] as a user and/or a service principal against [Microsoft Entra ID][]. The AzureCliCredential authenticates in a development environment and acquires a token on behalf of the logged-in user or service principal in Azure CLI. It acts as the Azure CLI logged in user or service principal and executes an Azure CLI command underneath to authenticate the application against Microsoft Entra ID.\n\n## Configure AzureCliCredential ##\n\nTo use this credential, the developer needs to authenticate locally in Azure CLI using one of the commands below:\n\n1. Run \"az login\" in Azure CLI to authenticate as a user.\n2. Run \"az login --service-principal --username \\{client ID\\} --password \\{client secret\\} --tenant \\{tenant ID\\}\" to authenticate as a service principal.\n\nYou may need to repeat this process after a certain time period, depending on the refresh token validity in your organization. Generally, the refresh token validity period is a few weeks to a few months. AzureCliCredential will prompt you to sign in again.\n\n**Sample: Construct AzureCliCredential**\n\nThe following code sample demonstrates the creation of a <xref uid=\"com.azure.identity.AzureCliCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"com.azure.identity.AzureCliCredential\"></xref>, using the <xref uid=\"com.azure.identity.AzureCliCredentialBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"com.azure.identity.AzureCliCredentialBuilder\"></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 azureCliCredential = new AzureCliCredentialBuilder()\n .build();\n```\n\n\n[authenticate interactively]: https://learn.microsoft.com/cli/azure/authenticate-azure-cli\n[Microsoft Entra ID]: https://learn.microsoft.com/entra/fundamentals/"
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