1.0.2-preview • Published 6 years ago
azure-monitor v1.0.2-preview
Microsoft Azure SDK for Node.js - Azure Monitor Management
The contents of this SDK have been moved to azure-arm-monitor and this SDK has been deprecated. Please change your dependency from azure-monitor to azure-arm-monitor.
This project provides a Node.js package that makes it easy to use the Azure Monitor API. Right now it supports:
- Node.js version: 6.x or higher
How to Install
npm install azure-monitor
How to Use
Authentication, client creation and listing activityLogs as an example.
const msRestAzure = require('ms-rest-azure');
const monitorClient = require('azure-monitor');
// Interactive Login
// It provides a url and code that needs to be copied and pasted in a browser and authenticated over there. If successful,
// the user will get a DeviceTokenCredentials object.
msRestAzure.interactiveLogin().then((credentials) => {
let client = new monitorManagementClient(credentials, 'your-subscription-id');
return client.activityLogs.list();
}).then((activityLogs) => {
console.log('List of activityLogs:');
console.dir(activityLogs, {depth: null, colors: true});
return;
}).catch((err) => {
console.log('An error ocurred');
console.dir(err, {depth: null, colors: true});
return;
});