大多数情况下,consumption.azure.com的v3 API都无法返回offerId

时间:2019-07-19 08:00:25

标签: azure

当我从

获取Azure定价表时
https://consumption.azure.com/v3/enrollments/{enrollmentNumber}/pricesheet 

返回的JSON是所有Azure组件的价格表。该列表有时会返回offerId的值(MS-AZR-0017PMS-AZR-0148P),但大多数情况下,所有返回的记录的值均为NULL。

问题:在列表中两次提及每个meterId,而offerId决定了正确的价格。如果没有offerId,我将无法确定具有相同meterId的两行中哪个具有正确的unitPrice和partNumber。

尝试1 (成功):

    "offerId": "MS-AZR-0017P",
    "id": "enrollments/{enrollmentNumber}/billingperiods/201907/products/1001543/pricesheets",
    "billingPeriodId": "201907",
    "meterId": "b28a9f2d-9323-4021-8421-db9e3847a535",
    "meterName": "Virtual Machines A Series Basic Windows - A2 - KR South",
    "unitOfMeasure": "100 Hours",
    "includedQuantity": 0.0000,
    "partNumber": "AAA-38759",
    "unitPrice": 12.3100,
    "currencyCode": "EUR"
  },
  {
    "offerId": "MS-AZR-0148P",
    "id": "enrollments/{enrollmentNumber}/billingperiods/201907/products/1001544/pricesheets",
    "billingPeriodId": "201907",
    "meterId": "b28a9f2d-9323-4021-8421-db9e3847a535",
    "meterName": "Virtual Machines A Series Basic Windows - A2 - Dev/Test - KR South",
    "unitOfMeasure": "100 Hours",
    "includedQuantity": 0.0000,
    "partNumber": "AAA-38881",
    "unitPrice": 8.1800,
    "currencyCode": "EUR"
  },

尝试n (失败):

    "offerId": null,
    "id": "enrollments/{enrollmentNumber}/billingperiods/201907/products/1001543/pricesheets",
    "billingPeriodId": "201907",
    "meterId": "b28a9f2d-9323-4021-8421-db9e3847a535",
    "meterName": "Virtual Machines A Series Basic Windows - A2 - KR South",
    "unitOfMeasure": "100 Hours",
    "includedQuantity": 0.0000,
    "partNumber": "AAA-38759",
    "unitPrice": 12.3100,
    "currencyCode": "EUR"
  },
  {
    "offerId": null,
    "id": "enrollments/{enrollmentNumber}/billingperiods/201907/products/1001544/pricesheets",
    "billingPeriodId": "201907",
    "meterId": "b28a9f2d-9323-4021-8421-db9e3847a535",
    "meterName": "Virtual Machines A Series Basic Windows - A2 - Dev/Test - KR South",
    "unitOfMeasure": "100 Hours",
    "includedQuantity": 0.0000,
    "partNumber": "AAA-38881",
    "unitPrice": 8.1800,
    "currencyCode": "EUR"
  },

我尝试使用Postman和在Azure Data Factory中通过REST调用多次获取JSON,但是似乎没有一种模式或可靠的方法来每次获取包含offerId的列表。 因为我想在DWH中使用此信息,所以需要API做出可靠且可预测的响应。

我希望API返回可靠且可预测的信息,每次查询API时,每条记录上都包含正确的offerId

要做的事情:一旦获得许可,我将在Azure门户中创建支持票证,以查找这是已知错误还是我做错了什么

v3版本的文档不是最新的。有关此特定端点的文档最近更新于2017年4月:

https://docs.microsoft.com/en-us/rest/api/billing/enterprise/billing-enterprise-api-pricesheet

其中提到了较早的v2版本。

UsageDetails页面上的文档:

https://docs.microsoft.com/en-us/rest/api/billing/enterprise/billing-enterprise-api-usage-detail

已于2019年3月更新,并提到了v3版本。

PriceSheet的v2和v3响应之间的最大区别是v3还返回了offerId,这使得可以确定正确的unitPricepartNumber在发票上提及。为了能够将发票详细信息与实际使用情况进行交叉引用,您需要知道正确的partNumber,为此,您需要offerId

还有另一种解决方案,但是在更改当前设置时需要进行大量工作。目前,我使用Azure导出功能每24小时将用法细节导出到CSV文件。这些文件将导入DWH中并进行进一步转换。但是CSV中的记录不包含partNumber。 v3 Usagedetails端点确实返回partNumber ...

摘要:我将创建一个Azure支持票证并等待答案。同时,我将尝试弄清楚该API为什么返回不同结果的原因。

问题:谁在使用API​​上遇到过类似的问题,您如何解决这些问题?

问题:API返回不同结果的原因可能是什么?

1 个答案:

答案 0 :(得分:0)

还有另一个价目表api

https://docs.microsoft.com/en-us/rest/api/consumption/pricesheet/get

它是在订阅级别而不是注册级别查询的,因此要获得完整的注册价格表,您必须针对每个订阅使用不同的优惠ID单独提出请求。