次の方法で共有


VisualStudioCodeCredential class

警告

この API は非推奨になりました。

This credential is deprecated because the VS Code Azure Account extension on which this credential relies has been deprecated. Users should use other dev-time credentials, such as AzureCliCredential, AzureDeveloperCliCredential, or AzurePowerShellCredential for their local development needs. See Azure Account extension deprecation notice here.

VSCode 拡張機能 'Azure アカウント' によって提供される資格情報を使用して Azure に接続します。 ユーザーが拡張機能を使用してログインすると、この資格情報は拡張機能によってキャッシュされたのと同じ更新トークンを共有できます。

この資格情報は、0.9.11より新しいバージョン Azure アカウント拡張機能 使用できないこと 既知の問題です。 この問題に対する長期的な修正が進行中です。 それまでの間は、AzureCliCredentialを使用した認証を検討してください。

コンストラクター

VisualStudioCodeCredential(VisualStudioCodeCredentialOptions)

VSCode 経由で自動的に認証するために使用する VisualStudioCodeCredential のインスタンスを作成します。

注意: VisualStudioCodeCredential はプラグインパッケージによって提供されています: @azure/identity-vscode. このパッケージがプラグイン API (useIdentityPlugin) を使用してインストールおよび登録されていない場合、VisualStudioCodeCredential を使用した認証は使用できません。

メソッド

getToken(string | string[], GetTokenOptions)

VSCode の認証キャッシュを検索して見つかったトークンを返します。トークンが見つからなかった場合は null を返します。

コンストラクターの詳細

VisualStudioCodeCredential(VisualStudioCodeCredentialOptions)

VSCode 経由で自動的に認証するために使用する VisualStudioCodeCredential のインスタンスを作成します。

注意: VisualStudioCodeCredential はプラグインパッケージによって提供されています: @azure/identity-vscode. このパッケージがプラグイン API (useIdentityPlugin) を使用してインストールおよび登録されていない場合、VisualStudioCodeCredential を使用した認証は使用できません。

new VisualStudioCodeCredential(options?: VisualStudioCodeCredentialOptions)

パラメーター

options
VisualStudioCodeCredentialOptions

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

メソッドの詳細

getToken(string | string[], GetTokenOptions)

VSCode の認証キャッシュを検索して見つかったトークンを返します。トークンが見つからなかった場合は null を返します。

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

パラメーター

scopes

string | string[]

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

options
GetTokenOptions

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

戻り値

Promise<AccessToken>