ManagedIdentityCredential class

デプロイ環境で使用可能なマネージド ID を使用して認証を試みます。 この認証の種類は、Azure VM、App Service インスタンス、Azure Functions アプリケーション、Azure Kubernetes Services、Azure Service Fabric インスタンス、および Azure Cloud Shell内で機能します。

マネージド ID の構成の詳細については、こちらを参照してください。 https://learn.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview

コンストラクター

ManagedIdentityCredential(ManagedIdentityCredentialClientIdOptions)

clientId を使用して ManagedIdentityCredential のインスタンスを作成します

ManagedIdentityCredential(ManagedIdentityCredentialResourceIdOptions)

リソース ID を使用して ManagedIdentityCredential のインスタンスを作成します

ManagedIdentityCredential(string, TokenCredentialOptions)

ユーザー割り当て ID のクライアント ID、またはアプリの登録 (AKS ポッド ID を使用する場合) を使用して、ManagedIdentityCredential のインスタンスを作成します。

メソッド

getToken(string | string[], GetTokenOptions)

Microsoft Entra IDで認証し、成功した場合はアクセス トークンを返します。 認証が失敗した場合は、失敗の詳細を含む CredentialUnavailableError がスローされます。 予期しないエラーが発生した場合は、エラーの詳細と共に AuthenticationError がスローされます。

コンストラクターの詳細

ManagedIdentityCredential(ManagedIdentityCredentialClientIdOptions)

clientId を使用して ManagedIdentityCredential のインスタンスを作成します

new ManagedIdentityCredential(options?: ManagedIdentityCredentialClientIdOptions)

パラメーター

options
ManagedIdentityCredentialClientIdOptions

アクセス トークン要求を行うクライアントを構成するためのオプション。

ManagedIdentityCredential(ManagedIdentityCredentialResourceIdOptions)

リソース ID を使用して ManagedIdentityCredential のインスタンスを作成します

new ManagedIdentityCredential(options?: ManagedIdentityCredentialResourceIdOptions)

パラメーター

options
ManagedIdentityCredentialResourceIdOptions

アクセス トークン要求を行うリソースを構成するためのオプション。

ManagedIdentityCredential(string, TokenCredentialOptions)

ユーザー割り当て ID のクライアント ID、またはアプリの登録 (AKS ポッド ID を使用する場合) を使用して、ManagedIdentityCredential のインスタンスを作成します。

new ManagedIdentityCredential(clientId: string, options?: TokenCredentialOptions)

パラメーター

clientId

string

ユーザー割り当て ID のクライアント ID、またはアプリの登録 (AKS ポッド ID を使用する場合)。

options
TokenCredentialOptions

アクセス トークン要求を行うクライアントを構成するためのオプション。

メソッドの詳細

getToken(string | string[], GetTokenOptions)

Microsoft Entra IDで認証し、成功した場合はアクセス トークンを返します。 認証が失敗した場合は、失敗の詳細を含む CredentialUnavailableError がスローされます。 予期しないエラーが発生した場合は、エラーの詳細と共に AuthenticationError がスローされます。

function getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>

パラメーター

scopes

string | string[]

トークンがアクセスできるスコープの一覧。

options
GetTokenOptions

この TokenCredential 実装が行う可能性のある要求を構成するために使用されるオプション。

戻り値

Promise<AccessToken>