0

I am seeing a weird error on the with Azure Node SDK where I get a 500 error back anytime i include anything in the filter attribute of the options parameter. I am using the Usage Details call within the ConsumptionManagementClient class. Code is below:

const credentials = await MsRest.loginWithServicePrincipalSecret(config.appId, config.apiKey, config.tenantId);
let client = new ConsumptionManagementClient(credentials, subscriptionId);
const scope = `/subscriptions/${subscriptionId}`;
const options = { filter: "usageStart ge datetime'2017-10-13T00:00:00.000Z'"};
let usage = await client.usageDetails.list(scope, options);

The above code produces a 500 error(even tried searching for other things another example being "billableQuantity ge 0.001") but it seems to error out no matter what i give it.

The code works fine when i try using another one of the options paramters:

const credentials = await MsRest.loginWithServicePrincipalSecret(config.appId, config.apiKey, config.tenantId);
let client = new ConsumptionManagementClient(credentials, subscriptionId);
const scope = `/subscriptions/${subscriptionId}`;
const options = { top: 50 };
let usage = await client.usageDetails.list(scope, options);

Any ideas? Thanks in advance for the help!

Jeff W
  • 538
  • 1
  • 5
  • 15
  • Reading the documentation here: https://github.com/Azure/azure-sdk-for-node/blob/3431d0d1a82f920c4a4e826d63b20f32d0815418/lib/services/consumptionManagement/lib/operations/usageDetails.js, it seems you can only `filter` by `usageEnd`. Could that be the reason for this 500 error you're getting? – Gaurav Mantri Oct 15 '17 at 14:12
  • i totally missed that the first time around :( it looks like i am still getting the error when i try "usageEnd ge datetime'2017-10-13T00:00:00.000Z'" any other ideas? – Jeff W Oct 15 '17 at 14:48
  • Just a hunch: Can you drop `datetime` from your filter criteria? Something like: `const options = { filter: "usageEnd ge '2017-10-13T00:00:00.000Z'"};` – Gaurav Mantri Oct 15 '17 at 14:59
  • no luck, still getting a 500 – Jeff W Oct 15 '17 at 15:15
  • Have you tried `const options = { filter: "usageEnd ge 2017-10-13T00:00:00Z" };`? – Aaron Chen Oct 17 '17 at 07:24

0 Answers0