共用方式為


MSITokenCredentials class

提供受控服務識別令牌認證的相關信息。 此物件只能用來取得在 Azure 中布建且具有受控服務識別之虛擬機上的令牌。

建構函式

MSITokenCredentials(MSIOptions)

建立 MSITokenCredentials 的實例。

屬性

resource

Azure 資源端點。

  • 默認為來自環境的 Azure Resource Manager:AzureCloud。 “https://management.azure.com/"
  • 針對 ServiceManagement (ASM):“https://management.core.windows.net/"
  • 針對 Azure KeyVault:“https://vault.azure.net"
  • 針對 Azure Batch:“https://batch.core.windows.net"
  • 針對 Azure Active Directory Graph:“https://graph.windows.net"

方法

getToken()

準備 POST 要求並將其傳送至裝載在 Azure VM 上的服務端點,該端點會以存取令牌回應。

parseTokenResponse(string)

將 tokenResponse json 字串剖析為 物件,並將第一層的屬性轉換為 camelCase。 此方法會嘗試標準化 tokenResponse

signRequest(WebResource)

使用驗證標頭簽署要求。

建構函式詳細資料

MSITokenCredentials(MSIOptions)

建立 MSITokenCredentials 的實例。

new MSITokenCredentials(options: MSIOptions)

參數

options
MSIOptions

選擇性參數

屬性詳細資料

resource

Azure 資源端點。

  • 默認為來自環境的 Azure Resource Manager:AzureCloud。 “https://management.azure.com/"
  • 針對 ServiceManagement (ASM):“https://management.core.windows.net/"
  • 針對 Azure KeyVault:“https://vault.azure.net"
  • 針對 Azure Batch:“https://batch.core.windows.net"
  • 針對 Azure Active Directory Graph:“https://graph.windows.net"
resource: string

屬性值

string

方法詳細資料

getToken()

準備 POST 要求並將其傳送至裝載在 Azure VM 上的服務端點,該端點會以存取令牌回應。

function getToken(): Promise<MSITokenResponse>

傳回

Promise<MSITokenResponse>

使用令牌回應承諾。

parseTokenResponse(string)

將 tokenResponse json 字串剖析為 物件,並將第一層的屬性轉換為 camelCase。 此方法會嘗試標準化 tokenResponse

function parseTokenResponse(body: string): TokenResponse

參數

body

string

json 字串

傳回

TokenResponse

tokenResponse (tokenType 和 accessToken 是兩個重要屬性)。

signRequest(WebResource)

使用驗證標頭簽署要求。

function signRequest(webResource: WebResource): Promise<WebResource>

參數

webResource
WebResource

要簽署的 WebResource。

傳回

Promise<WebResource>

具有已簽署 WebResource 的承諾。