简体   繁体   English

从 Azure 计费发票 CSV 文件中获取总成本

[英]Get total cost from Azure billing Invoice CSV file

  • I have added a schedule export for my Azure Resource Group Billing invoice on a monthly basis.我已按月为 Azure 资源组计费发票添加了计划导出。 The invoice generated will consist of the billing details of the Last Month and will store the .CSV file in my storage account as a Blob every month.生成的发票将包含上个月的帐单详细信息,并将每月将 .CSV 文件作为 Blob 存储在我的存储帐户中。

  • I'm using an Azure Logic app to retrieve the Invoice file and send it via mail to a group of recipients.我正在使用 Azure 逻辑应用来检索发票文件并通过邮件将其发送给一组收件人。

  • The invoice is a .CSV file which consists of a number of columns like "InstanceID, MeterID, UsageQuantity, ResourceLocation".发票是一个 .CSV 文件,由许多列组成,如“InstanceID、MeterID、UsageQuantity、ResourceLocation”。 But I need to get the TOTAL COST for the billing period.但我需要获得计费周期的总成本。

Any idea how I can achieve this?知道我如何实现这一目标吗? Is there a specific column that I need to include in my CSV file.是否需要在我的 CSV 文件中包含特定的列。 Or do I need to do some sort of data processing of the CSV file to get the total amount of resources consumed?或者我是否需要对 CSV 文件进行某种数据处理才能获得消耗的资源总量?

Any advise on this?对此有何建议? Thanks!谢谢!

1. I created a csv file(named billing.csv ) as below and upload it to blob storage. 1.我创建了一个 csv 文件(名为billing.csv ),如下所示并将其上传到 blob 存储。

InstanceID, MeterID, UsageQuantity, ResourceLocation, Pre tax cost
1,1,2,aa,10
2,2,3,bb,20
3,3,5,cc,30

2. In logic app, use " Get blob content " to get the csv file. 2.在逻辑应用程序中,使用“获取 blob 内容”来获取 csv 文件。 在此处输入图片说明

3. Search the action " Parse CSV " in you logic app. 3.在您的逻辑应用中搜索操作“解析 CSV ”。 在此处输入图片说明

4. The "Parse CSV" action will ask you to input "API Key", you need to go to this page first --> click "Start free trial", register an account and create a new API Key. 4. “解析CSV”动作会要求你输入“API Key”,你需要先到这个页面-->点击“开始免费试用”,注册一个账户并创建一个新的API Key。 在此处输入图片说明 Copy the secret and paste it to your logic app as "API key", it will allow you to connect Plumsail.复制秘密并将其作为“API 密钥”粘贴到您的逻辑应用程序中,它将允许您连接 Plumsail。 在此处输入图片说明

5. Then choose the blob content into the "Parse CSV" and input the headers InstanceID, MeterID, UsageQuantity, ResourceLocation, Pre tax cost . 5.然后选择 blob 内容到“解析 CSV”并输入标题InstanceID, MeterID, UsageQuantity, ResourceLocation, Pre tax cost Add a new parameter "Skip first line" and set its value as Yes .添加一个新参数“跳过第一行”并将其值设置为Yes

在此处输入图片说明

6. Initialize a variable sum and set its value as 0 in integer type. 6.初始化一个变量sum并将其值设置为整数类型的0 Initialize another variable tempItem and also set its value as 0 .初始化另一个变量tempItem并将其值设置为0

在此处输入图片说明

7. Use a " For each " loop. 7.使用“ For each ”循环。

在此处输入图片说明

The Body comes from " Parse CSV " action and the expression of "value" is: add(variables('tempItem'), int(items('For_each')?['Pre tax cost'])) Body来自“解析CSV ”动作,“值”的表达式为: add(variables('tempItem'), int(items('For_each')?['Pre tax cost']))

8. After running the logic app, we can see the sum in last loop is: 8.运行逻辑应用程序后,我们可以看到最后一个循环中的sum为: 在此处输入图片说明

9. Here is the whole logic app for your reference: 9.这是整个逻辑应用程序供您参考: 在此处输入图片说明

Import:进口:

This solution uses the third party connector " Plumsail Documents ", I'm not sure if it is free.此解决方案使用第三方连接器“ Plumsail Documents ”,我不确定它是否免费。 I registered account in the past, it worked without any cost.我过去注册了帐户,它没有任何费用。 But today the api key can't continue use, I need to register another account and create another api key.但是今天这个api key不能继续使用了,需要重新注册一个账号,创建另一个api key。 So I think this third party connector need extra cost if you want to use it for a long time.所以我认为这个第三方连接器如果你想长期使用它需要额外的成本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Schedule-Export Billing Invoice of Azure Resource-Group 每月成本分析 - Schedule-Export Billing Invoice of Azure Resource-Group cost analysis monthly 通过电子邮件获取资源组使用情况的月度 Azure 计费发票 - Get monthly Azure billing invoice of Resource Group usage via email 如何使用Azure Billing API获取总账单金额 - How to get total billing amount with azure billing API Azure 逻辑应用从 CSV 文件计算列的总和 - Azure Logic App calculate Total Sum of a column from a CSV file 使用应用服务节省 Azure 计费成本? - Saving on Azure billing cost with App Services? 使用 Azure 计费 API/SDK 显示 Azure 成本分析数据 - Show azure cost analysis data using Azure billing API/SDK 可以在 Azure Api 管理中按产品监控成本/计费吗? - Possible to monitor Cost/billing by Products in Azure Api Management? Azure函数应用程序的计费,成本和性能取决于函数的数量 - Azure function app billing, cost and performance depending on the number of functions Node.js客户端连接和Azure交易计费费用 - Node.js client connection and Azure Transaction billing cost 我无法获得月度帐单信息。 为什么我对 Azure 成本管理和消费 API 的访问无法在 CSP azure 优惠上获得此功能? - I cannot get monthly billing information. Why does my access to Azure Cost Management and consumption APIs fail to get this on a CSP azure offer?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM