Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EnvironmentCredential

Package version

Enables authentication to Azure Active Directory using client secret details configured in the following environment variables:

  • AZURE_TENANT_ID: The Azure Active Directory tenant (directory) ID.
  • AZURE_CLIENT_ID: The client (application) ID of an App Registration in the tenant.
  • AZURE_CLIENT_SECRET: A client secret that was generated for the App Registration.

This credential ultimately uses a ClientSecretCredential to perform the authentication using these details. Please consult the documentation of that class for more details.

Hierarchy

  • EnvironmentCredential

Implements

  • any
  • any

Index

Constructors

Methods

Constructors

constructor

  • Creates an instance of the EnvironmentCredential class and reads client secret details from environment variables. If the expected environment variables are not found at this time, the getToken method will return null when invoked.

    Parameters

    • Optional options: TokenCredentialOptions

      Options for configuring the client which makes the authentication request.

    Returns EnvironmentCredential

Methods

getToken

  • getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>
  • Authenticates with Azure Active Directory and returns an access token if successful.

    Parameters

    • scopes: string | string[]

      The list of scopes for which the token will have access.

    • Default value options: GetTokenOptions = {}

      Optional parameters. See {@link GetTokenOptions}.

    Returns Promise<AccessToken>

Generated using TypeDoc