Azure SDK列表订阅

时间:2018-06-08 07:59:30

标签: javascript node.js azure subscription azure-sdk

如何列出azure帐户的所有SubscriptionIds? 我现在拥有的是:

const sub = require('azure-asm-subscription');

//getting the credentials

const subclient = sub.createSubscriptionClient(credentials);
subclient.subscriptions.list((err, data) => {
  console.log(data);
});

但是这会返回一个status code of 200(说一切都没问题),但是订阅数组是空的。但他们至少有一个订阅。

1 个答案:

答案 0 :(得分:0)

好吧,我找到了解决方案:

const ArmResource = require('azure-arm-resource');

const subClient = new ArmResource.SubscriptionClient(credentials);
subClient.subscriptions.list().then(data => {
  console.log(data);
})