# azure-asm-network

> Microsoft Azure Virtual Network Management Client Library for node

Latest version **0.13.1** (published 2016-09-02) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install azure-asm-network
pnpm add azure-asm-network
yarn add azure-asm-network
bun add azure-asm-network
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.13.1 |
| Published | 2016-09-02 |
| First published | 2015-05-04 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1174 |
| Author | Microsoft Corporation |
| Maintainers | windowsazure |
| Keywords | node, azure |

## Links

- npm: https://www.npmjs.com/package/azure-asm-network
- Repository: https://github.com/Azure/azure-sdk-for-node
- Homepage: http://github.com/Azure/azure-sdk-for-node
- Issues: http://github.com/Azure/azure-sdk-for-node/issues
- npm.io page: https://npm.io/package/azure-asm-network

## Dependencies (1)

- [azure-common](https://npm.io/package/azure-common.md) ^0.9.13

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.13.1 (latest) — 2016-09-02
- 0.13.0 — 2016-07-27
- 0.12.0 — 2016-07-06
- 0.11.0 — 2016-04-22
- 0.10.2 — 2015-08-13
- 0.10.1 — 2015-06-08
- 0.10.0 — 2015-05-04

## README

# Microsoft Azure SDK for Node.js - Virtual Network Management

This project provides a Node.js package that makes it easy to manage Microsoft Azure Virtual Network. Right now it supports:
- **API version: 2016-07-01**

## Features

- Manage network
- Manage gateway
- Manage reserved IP
- Manage client root certificate

## How to Install

```bash
npm install azure-asm-network
```

## How to Use

### Authentication

This library support management certificate authentication. To authenticate the library for the REST API calls, you need to
* Have a management certificate set up in your Microsoft Azure subscription. You can do this by
  * Either uploading a certificate in the [Microsoft Azure management portal](https://manage.windowsazure.com).
  * Or use the [Microsoft Azure Xplat-CLI](https://github.com/Azure/azure-xplat-cli).
* Obtain the .pem file of your certificate. If you used [Microsoft Azure Xplat-CLI](https://github.com/Azure/azure-xplat-cli) to set it up. You can run ``azure account cert export`` to get the .pem file.

### Create the VirtualNetworkManagementClient

```javascript
var fs             = require('fs'),
    vnetManagement = require('azure-asm-network');

var vnetManagementClient = vnetManagement.createNetworkManagementClient(vnetManagement.createCertificateCloudCredentials({
  subscriptionId: '<your subscription id>',
  pem: fs.readFileSync('<your pem file>')
}));
```

### Manage Network

```javascript
var xml2js = require("xml2js");

var affinityGroupName = "affinitygroup01";
var vnetSiteName = "vnet01";
var subnetName = "subnet01";

// List all the virtual networks under a subscription.
vnetManagementClient.networks.list(function (err, result) {
  if (err) {
    console.error(err);
  } else {
    console.info(result);
  }
});

// Get the virtual network configuration xml.
vnetManagementClient.networks.getConfiguration(function (err, result) {
  if (err) {
    console.error(err);
  } else {
    // Create a new virtual network site.
    xml2js.parseString(result.configuration, function (err2, config) {
      var vnets = config.NetworkConfiguration.VirtualNetworkConfiguration[0].VirtualNetworkSites[0].VirtualNetworkSite;
      vnets.push({
        "$": {
          AffinityGroup: affinityGroupName,
          name: vnetSiteName
        },
        AddressSpace: [{
          AddressPrefix: ["10.0.0.0/8"]
        }],
        Subnets: [{
          Subnet: [{
            "$": {
              name: subnetName
            },
            AddressPrefix: ["10.0.0.0/8"]
          }]
        }]
      });

      vnetManagementClient.networks.setConfiguration({
        configuration: (new xml2js.Builder()).buildObject(config)
      }, function (err3, result3) {
        if (err3) {
          console.error(err3);
        } else {
          console.info(result3);
        }
      });
    });
  }
});
```

## Related projects

- [Microsoft Azure SDK for Node.js](https://github.com/WindowsAzure/azure-sdk-for-node)
- [Microsoft Azure SDK for Node.js - Compute Management](https://github.com/WindowsAzure/azure-sdk-for-node/tree/master/lib/services/computeManagement)

---
_Source: https://npm.io/package/azure-asm-network · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
