# azure-arm-resource

> Microsoft Azure Resource Management Client Library for node

Latest version **7.4.0** (published 2020-06-10) · MIT license · 0 weekly downloads

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

## Install

```sh
npm install azure-arm-resource
pnpm add azure-arm-resource
yarn add azure-arm-resource
bun add azure-arm-resource
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 7.4.0 |
| Published | 2020-06-10 |
| First published | 2015-05-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 3.2 MB |
| 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-arm-resource
- Repository: https://github.com/Azure/azure-sdk-for-node
- Homepage: http://github.com/Azure/azure-sdk-for-node/tree/master/lib/services/resourceManagement
- Issues: http://github.com/Azure/azure-sdk-for-node/issues
- npm.io page: https://npm.io/package/azure-arm-resource

## Dependencies (2)

- [ms-rest](https://npm.io/package/ms-rest.md) ^2.3.3
- [ms-rest-azure](https://npm.io/package/ms-rest-azure.md) ^2.5.5

## 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

- 7.4.0 (latest) — 2020-06-10
- 7.3.0 — 2018-12-20
- 7.2.1 — 2018-11-20
- 7.2.0 — 2018-11-15
- 7.1.0 — 2018-11-07
- 7.0.1 — 2018-10-23
- 7.0.0 — 2018-09-25
- 6.0.0 — 2018-09-20
- 5.1.1 — 2018-09-20
- 5.1.0 — 2018-09-19
- 5.0.0 — 2018-09-10
- 4.1.0-preview — 2018-08-23
- 4.0.0-preview — 2018-08-22
- 3.1.1-preview — 2018-02-28
- 3.1.0-preview — 2018-01-03
- … 22 more at https://npm.io/package/azure-arm-resource/versions

## README

# Microsoft Azure SDK for Node.js - Resource Management

This project provides a Node.js package that makes it easy to manage Azure resources. Right now it supports:
- **Node.js version: 6.x.x or higher**

## How to Install

```bash
npm install azure-arm-resource
```

## How to Use

### Authentication, client creation and listing resources as an example

 ```javascript
 var msRestAzure = require('ms-rest-azure');
 var resourceManagement = require("azure-arm-resource");
 
 // Interactive Login
 msRestAzure.interactiveLogin(function(err, credentials) {
  var client = new resourceManagement.ResourceManagementClient(credentials, 'your-subscription-id');
  client.resources.list(function(err, result) {
    if (err) console.log(err);
    console.log(result);
  });
 });
 ```

## Creating a Resource Group

```javascript
var util = require('util');
var groupParameters = {
  location: 'West US',
  tags: {
    tag1: 'val1',
    tag2: 'val2'
  }
};
var groupName = 'testGroup1';
client.resourceGroups.createOrUpdate(groupName, groupParameters, function (err, result, request, response) {
  if (err) {
    console.log(err);
    /*err has reference to the actual request and response, so you can see what was sent and received on the wire.
      The structure of err looks like this:
      err: {
        code: 'Error Code',
        message: 'Error Message',
        body: 'The response body if any',
        request: reference to a stripped version of http request
        response: reference to a stripped version of the response
      }
    */
  } else {
    console.log('result is: ' + util.inspect(result, {depth: null}));
  }
});
```

## Create a Generic Resource in a Resource Group

```javascript
var groupName = 'testGroup1';
var resourceName = 'autorestsite102';
var params = { 'location': 'West US', 'properties' : { 'SiteMode': 'Limited', 'ComputeMode': 'Shared' }, 'Name': resourceName };
var resourceType = 'sites';
var parentResourcePath = '';
var resourceProviderNamespace = 'Microsoft.Web';
var apiVersion = '2014-04-01';
client.resources.createOrUpdate(groupName, resourceProviderNamespace, parentResourcePath, 
  resourceType, resourceName , apiVersion, params, function (err, result, request, response) {
  if (err) {
    console.log(err);
  } else {
    console.log(result);
  }
});
```

## Get a Generic Resource in a Resource Group

```javascript
var groupName = 'testGroup1';
var resourceName = 'autorestsite102';
var resourceType = 'sites';
var parentResourcePath = '';
var resourceProviderNamespace = 'Microsoft.Web';
var apiVersion = '2014-04-01';
client.resources.get(groupName, resourceProviderNamespace, parentResourcePath, 
  resourceType, resourceName, apiVersion, function (err, result, request, response) {
  if (err) {
    console.log(err);
  } else {
    console.log(result);
  }
});
```

## Listing all resources in your subscription

```javascript
client.resources.list(function (err, result, request, response) {
  if (err) {
    console.log(err);
  } else {
    console.log(result);
  }
});
```

## Deleting a Generic Resource in a Resource Group

```javascript
var groupName = 'testGroup1';
var resourceName = 'autorestsite102';
var resourceType = 'sites';
var parentResourcePath = '';
var resourceProviderNamespace = 'Microsoft.Web';
var apiVersion = '2014-04-01';
client.resources.deleteMethod(groupName, resourceProviderNamespace, parentResourcePath, 
  resourceType, resourceName, apiVersion, function (err, result, request, response) {
  if (err) {
    console.log(err);
  } else {
    console.log(result);
  }
});
```

## Deleting the Resource Group

```javascript
var groupName = 'testGroup1';
client.resourceGroups.deleteMethod(groupName, function (err, result, request, response) {
  if (err) {
    console.log(err);
  } else {
    console.log(result);
  }
});
```
Please take a look at the tests over [here](https://github.com/Azure/azure-sdk-for-node/tree/autorest/test/services/resourceManagement) for more examples.

## Related projects

- [Microsoft Azure SDK for Node.js - All-up](https://github.com/Azure/azure-sdk-for-node)


![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-node%2Flib%2Fservices%2FresourceManagement%2FREADME.png)

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