適用於 Node.js 的 Azure DevTest Labs 模組Azure DevTest Labs modules for Node.js

Azure DevTest Labs 是一項服務,可協助開發人員和測試人員在 Azure 中建立快速環境,同時將浪費降至最低並控制成本。Azure DevTest Labs is a service that helps developers and testers quickly create environments in Azure while minimizing waste and controlling cost. 您可以利用可重複使用的範本和構件快速佈建 Windows 和 Linux 環境,來測試最新版的應用程式。You can test the latest version of your application by quickly provisioning Windows and Linux environments using reusable templates and artifacts. 將您的部署管線與研發/測試實驗室輕鬆整合,來佈建隨選環境。Easily integrate your deployment pipeline with DevTest Labs to provision on-demand environments. 藉由佈建多個測試代理程式來相應增加您的負載測試,並建立預先佈建的環境來進行訓練和示範。Scale up your load testing by provisioning multiple test agents, and create pre-provisioned environments for training and demos.

管理封裝Management package

安裝 npm 模組Install the npm module

安裝 Azure DevTest Labs npm 模組Install the Azure DevTest Labs npm module

npm install azure-arm-devtestlabs

範例Example

此範例會取得並列印實驗室的詳細資料。This example gets and prints the details of a lab.

const msRestAzure = require('ms-rest-azure');
const DevTestLabsClient = require('azure-arm-devtestlabs');

const subscriptionId = 'your-subscription-id';
const resourceGroupName = 'your-resource-group-name';
const labName = 'your-lab-name';

msRestAzure
  .interactiveLogin()
  .then(credentials => {
    const client = new DevTestLabsClient(credentials, subscriptionId);
    return client.labOperations.getResource(resourceGroupName, labName);
  })
  .then(lab => {
    console.log('Details of lab:');
    console.dir(lab, { depth: null, colors: true });
  });

範例Samples

深入探索可在應用程式中使用的 Node.js 程式碼範例Explore more sample Node.js code you can use in your apps.