AzurePowerShellCredential class

此憑證將使用目前已登入的 Azure PowerShell 模組使用者資訊。 為此,它會用指令讀取使用者存取權杖及過期時間

建構函式

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>