AzurePowerShellCredential class

この資格情報では、Azure PowerShell モジュールから現在ログインしているユーザー情報が使用されます。 これを行うには、ユーザー アクセス トークンを読み取り、Azure PowerShell コマンドを使用して有効期限が切れますGet-AzAccessToken -ResourceUrl {ResourceScope}

コンストラクター

AzurePowerShellCredential(AzurePowerShellCredentialOptions)

AzurePowerShellCredential のインスタンスを作成します。

この資格情報を使用するには:

  • 次を使用して Azure Az PowerShell モジュールをインストールします Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force
  • コマンド ラインから コマンドConnect-AzAccountを使用して、Azure PowerShellに既にログインしています。

メソッド

getToken(string | string[], GetTokenOptions)

Microsoft Entra IDで認証し、成功した場合はアクセス トークンを返します。 認証を PowerShell で実行できない場合は、 CredentialUnavailableError がスローされます。

コンストラクターの詳細

AzurePowerShellCredential(AzurePowerShellCredentialOptions)

AzurePowerShellCredential のインスタンスを作成します。

この資格情報を使用するには:

  • 次を使用して Azure Az PowerShell モジュールをインストールします Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force
  • コマンド ラインから コマンドConnect-AzAccountを使用して、Azure PowerShellに既にログインしています。
new AzurePowerShellCredential(options?: AzurePowerShellCredentialOptions)

パラメーター

options
AzurePowerShellCredentialOptions

オプション。必要に応じてマルチテナント要求を許可します。

メソッドの詳細

getToken(string | string[], GetTokenOptions)

Microsoft Entra IDで認証し、成功した場合はアクセス トークンを返します。 認証を PowerShell で実行できない場合は、 CredentialUnavailableError がスローされます。

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

パラメーター

scopes

string | string[]

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

options
GetTokenOptions

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

戻り値

Promise<AccessToken>