简体   繁体   中英

How to use azure-cli node package in Node js application

I am developing a Node js application. I want to use the azure-cli package in my application to create HDI cluster and VM.

npm install azure-cli -g --save

Above command install the azure-cli v1.0 only.

How and where should I use the azure commands in my application.

Should I need write azure cli commands in shell script file and call that script file from node js application or any other way like calling azure cli commands in the node js application without a script file?

Note: Why azure-cli doesn't install azure cli V2.0

Update 1:-

If I install winston package application, I can use like the following

 var winston = require('winston');

  winston.log('info', 'Hello distributed log files!');
  winston.info('Hello again distributed logs');

Like that, Is there a way to use if I install azure-cli ? (ie inside my node js application)

To answer your specific question around creating a VM or HDI (Hadoop cluster) in your Node.js app, the best approach would be to use the Azure SDK for Node.

  1. For VMs, use npm install azure-arm-compute and follow instructions in VM Modules for NodeJS
  2. For Hadoop, use npm install azure-arm-hdinsight and follow reference for azure-arm-hdinsight package

The older version of the Azure CLI was Node.js based, while the current version of the Azure CLI (v2) is Python based. You can install the latest version via the multiple mechanisms provided in http://aka.ms/cli .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM