適用於 Node.js 的 Azure 虛擬網路模組Azure Virtual Network modules for Node.js

概觀Overview

Azure 虛擬網路服務可讓 Azure 資源與虛擬網路 (VNet) 安全地彼此連接。The Azure Virtual Network service enables you to securely connect Azure resources to each other with virtual networks (VNets). VNet 是您的網路在雲端中的身分。A VNet is a representation of your own network in the cloud. VNet 是專屬於您訂用帳戶的 Azure 雲端邏輯隔離。A VNet is a logical isolation of the Azure cloud dedicated to your subscription. 您也可以將 VNet 連線到內部部署網路。You can also connect VNets to your on-premises network.

深入了解 Azure 虛擬網路Learn more about Azure Virtual Network.

管理封裝Management package

安裝 npm 模組Install the npm module

安裝 Azure 虛擬網路 npm 模組Install the Azure Virtual Network npm module

npm install azure-arm-network

範例Example

此範例會取得並列印虛擬網路的清單This example gets and prints the list of virtual networks

const msRestAzure = require('ms-rest-azure');
const NetworkManagementClient = require('azure-arm-network');

const subscriptionId = 'your-subscription-id';
const resourceGroup = 'your-resource-group-name';

msRestAzure
  .interactiveLogin()
  .then(credentials => {
    const client = new NetworkManagementClient(credentials, subscriptionId);
    return client.virtualNetworks.list(resourceGroup);
  })
  .then(networkList => {
    console.log('List of virtual networks:');
    console.dir(networkList, { depth: null, colors: true });
  });

範例Samples

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