你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
EA customers who were previously using the Enterprise Reporting APIs behind the consumption.azure.com endpoint to obtain usage details and marketplace charges need to migrate to new and improved solutions. 下文概述了执行此操作的说明以及旧 API 和新解决方案之间的协定差异。
The dataset is referred to as cost details instead of usage details.
Note
所有 Azure 企业报告 API 均已停用。 你应尽快迁移到 Microsoft 成本管理 API。
新解决方案正式发布
下表提供了可用迁移目标的摘要,以及选择哪种解决方案最适合时要考虑的事项摘要。
| Solution | Description | Considerations | Onboarding info |
|---|---|---|---|
| Exports | 按计划定期将数据转储到存储 | - 工作负载最可缩放的解决方案。 - 可配置为对更大的数据集使用文件分区。 - 非常适合建立和增加可与自己的可查询数据存储集成的成本数据集。 - 需要访问可以保存数据的存储帐户。 |
-
在 Azure 门户中配置 使用 API 自动创建导出 - 导出 API 参考 |
| 成本详细信息 API | 按需下载 | - 适用于小型成本数据集。 - 对于因安全或可管理性问题导致导出到 Azure 存储不可行的应用场景非常有用。 |
-
按需获取低成本数据集 - Cost Details API |
Generally we recommend using Exports if you have ongoing data ingestion needs and/or a large monthly cost details dataset. 有关详细信息,请参阅引入成本详细信息数据。 如果需要其他信息来帮助你为工作负载做出决策,请参阅选择成本详细信息解决方案。
将权限分配给 SPN 以调用 API
如果要以编程方式调用导出或成本详细信息 API,需要使用正确的权限配置服务主体。 有关详细信息,请参阅向 ACM API 分配权限。
避免 Microsoft 消耗使用情况详细信息 API
消耗使用情况详细信息 API 是目前支持 EA 客户的另一个终结点。 请勿迁移到此 API。 迁移到导出或成本详细信息 API,如本文档前面所述。 消耗使用情况详细信息 API 位于下面的终结点后面,以后将被弃用。
GET https://management.azure.com/{scope}/providers/Microsoft.Consumption/usageDetails?api-version=2021-10-01
此 API 是一个同步终结点,由于支出和逐月成本数据集的大小增加,它将无法缩放。 如果当前使用的是消耗使用情况详细信息 API,建议尽快将其迁移到导出或成本详细信息 API。 正式弃用公告将在未来发布。 要详细了解如何从消耗使用情况详细信息迁移,请参阅从消耗使用情况详细信息 API 迁移。
Migration benefits
新解决方案与 EA 报告使用情况详细信息 API 相比提供了诸多优势。 总结如下:
- 安全性和稳定性 - 新解决方案需要服务主体和/或用户令牌才能访问数据。 与用于向 EA 报告 API 进行身份验证的 API 密钥相比,它们的安全性更高。 这些旧 API 中的密钥有效期为 6 个月,如果泄露,可能会公开敏感的财务数据。 此外,如果密钥未在六个月的失效期之前续订并集成到工作负载中,则会撤销数据访问权限。 这会中断客户工作负载。
- Scalability - The EA Reporting APIs aren't built to scale well as your Azure usage increases. 随着将更多资源部署到云中,使用情况详细信息数据集可能会变得非常大。 新解决方案是异步执行的,其背后具有广泛的基础结构增强功能,可确保成功下载任何大小的数据集。
- 面向所有使用情况详细信息的单个数据集 - Azure 和 Azure 市场使用情况详细信息已合并到新解决方案中的一个数据集内。 单个数据集减少了查看所有费用需要调用的 API 数。
- Purchase amortization - Customers who purchase Reservations can see an Amortized view of their costs using the new solutions.
- Schema consistency - Each solution that is available provides files with matching fields. 使用该解决方案,可以根据应用场景在解决方案之间轻松切换。
- 成本分配集成 - 企业协议和 Microsoft 客户协议客户可以使用新解决方案来查看与其配置的成本分配规则相关的费用。 For more information about cost allocation, see Allocate costs.
- 推进改进 - 正在积极开发新的解决方案。 发布后,解决方案将接收所有新功能。
要迁移的企业使用情况 API
下表汇总了目前可能正在用于引入成本详细信息数据的不同的 API。 如果使用以下 API 之一,则需要迁移到上文介绍的新解决方案之一。 所有 API 都位于 https://consumption.azure.com 终结点后面。
| Endpoint | API Comments |
|---|---|
/v3/enrollments/{enrollmentNumber}/usagedetails/download?billingPeriod={billingPeriod} |
- API 方法:GET - 同步(非轮询) - 数据格式:CSV |
/v3/enrollments/{enrollmentNumber}/usagedetails/download?startTime=2017-01-01&endTime=2017-01-10 |
- API 方法:GET - 同步(非轮询) - 数据格式:CSV |
/v3/enrollments/{enrollmentNumber}/usagedetails |
- API 方法:GET - 同步(非轮询) - 数据格式:JSON |
/v3/enrollments/{enrollmentNumber}/billingPeriods/{billingPeriod}/usagedetails |
- API 方法:GET - 同步(非轮询) - 数据格式:JSON |
/v3/enrollments/{enrollmentNumber}/usagedetailsbycustomdate?startTime=2017-01-01&endTime=2017-01-10 |
- API 方法:GET - 同步(非轮询) - 数据格式:JSON |
/v3/enrollments/{enrollmentNumber}/usagedetails/submit?billingPeriod={billingPeriod} |
- API 方法:POST - 异步(基于轮询) - 数据格式:CSV |
/v3/enrollments/{enrollmentNumber}/usagedetails/submit?startTime=2017-04-01&endTime=2017-04-10 |
- API 方法:POST - 异步(基于轮询) - 数据格式:CSV |
数据字段映射
下表汇总了当前使用的解决方案中可用的旧字段,以及要在新解决方案中使用的字段。
| Old field | New field | Comments |
|---|---|---|
| accountId | ||
| accountName | AccountName | |
| accountOwnerEmail | AccountOwnerId | |
| additionalInfo | AdditionalInfo | |
| chargesBilledSeparately | isAzureCreditEligible | 属性是相反的。 如果 isAzureCreditEnabled 为 true,则 ChargesBilledSeparately 为 false。 |
| consumedQuantity | Quantity | |
| consumedService | ConsumedService | |
| consumedServiceId | ConsumedService |
consumedServiceId 仅提供数字值。ConsumedService 提供服务的名称。 |
| cost | CostInBillingCurrency | |
| costCenter | CostCenter | |
| date | Date | 旧字段中的格式为 yyyy-mm-dd,而新字段的格式为 mm/dd/yy。 |
| departmentId | InvoiceSectionId | |
| departmentName | InvoiceSectionName | |
| extendedCost | CostInBillingCurrency | |
| instanceId | ResourceId | |
| isRecurringCharge | 如果适用,请使用 Frequency 和 Term fields 继续。 |
|
| 位置 | ResourceLocationNormalized | |
| meterCategory | MeterCategory | |
| meterId | MeterId | |
| meterName | MeterName | |
| meterRegion | MeterRegion | |
| meterSubCategory | MeterSubCategory | |
| offerId | OfferId | |
| orderNumber | Not available. | |
| partNumber | PartNumber | |
| planName | PlanName | |
| product | ProductName | |
| publisherName | PublisherName | |
| resourceGroup | ResourceGroup | |
| resourceGuid | MeterId | Values vary.
resourceGuid 是 GUID 值。
meterId 是长数字。 |
| resourceLocation | ResourceLocation | |
| resourceLocationId | Not available. | |
| resourceRate | EffectivePrice | |
| serviceInfo1 | ServiceInfo1 | |
| serviceInfo2 | ServiceInfo2 | |
| serviceName | MeterCategory | |
| serviceTier | MeterSubCategory | |
| storeServiceIdentifier | Not available. | |
| subscriptionGuid | SubscriptionId | |
| subscriptionId | SubscriptionId | |
| subscriptionName | SubscriptionName | |
| tags | Tags | 新字段的键值对周围没有封闭的 {}。 |
| unitOfMeasure | UnitOfMeasure |