Azure Reserved Instances — Ingestion and Cost Allocations

Microsoft Azure released Reserved Instances (RIs) in late 2017. The costs associated with these RIs can be considerable and will need to be accounted for when considering your Azure spend.

Applies to: Cloud Cost Management on TBM Studio 12.5+.

Overview

Currently, RI charges are not reflected in the Azure EA bill and need to be ingested separately and then allocated to the appropriate resources (VMs) such that the effective costs of those VMs are appropriately calculated.

This guide provides the steps necessary to ingest your organization’s RI charges and accurately allocate those charges to the appropriate resources in your Azure EA bill.

Implications in Adaption:

  • Access Reserved Instance charges — RI costs are not reflected in the Azure EA bill and will need to be brought into Apptio via a Datalink (Classic) REST connector.
  • Amortization and allocation of Reserved Instance costs — RI costs will need to be amortized over the term of the RI and then allocated to the resources in the bill that benefit from those RI purchases.

Obtain Azure EA authentication credentials

This connector will use the Azure EA enrollment number and API Access Key. Both can be obtained via your Azure EA Portal. For more instructions, see Complete Azure configuration dependencies.

Procedure

  1. Navigate to DataLink.
  2. In your default agent, click New Connector.
  3. Select a REST Service connector.
  4. Name the connector.
  5. In the REST URL field, enter the following API URL, replacing the enrollment ID with your Azure EA enrollment ID: https://consumption.azure.com/v3/enrollments/{enrollment id}/reservationcharges.
  6. Leave the Requires Authentication field blank.
  7. Check the Has Headers checkbox.
  8. In Headers Key field, enter Authorization.
  9. In Headers Value field, enter bearer (with a space at the end), then paste in your Azure EA API Access Key.
  10. Select the Has Query Arguments checkbox.
  11. In the first Query Arguments Key field, enter startDate and, in the corresponding Value field, enter the beginning date of the time frame over which your RIs were purchased. Make this date early enough to cover the start date of any active RIs.
  12. Add a new query argument.
  13. In the new Key/Value line, enter endDate in the Key field and enter the last day of the current month. You cannot enter a value beyond that date. This means that you will need to update the endDate value prior to running the connector in subsequent months. (Apptio is working on an improved solution that will allow this to be run on a periodic basis without manual intervention.)
  14. Select the Time Period for which this connector is to be run, either Previous or Current Month.
  15. Ensure that the JSON Passthrough checkbox is checked.
  16. Enter your Apptio Destination details.
  17. Enable Notifications.
  18. Schedule the connector as necessary.

Append the RI Charges dataset to the Apptio Master Data

Procedure

  1. In TBM Studio, navigate to the table where the Azure data was loaded into via DataLink.
  2. Check out the table and update all of the Types as needed on the import step.
  3. Create a new table called “Azure RI Purchases Transform.”
  4. On the Source step, click Existing Table. Select the table that the Azure data was loaded into from the above connector.
  5. Add a Formula step after the Existing Table step, and add the following formulas:
    • Active Days per Month
                    =if(Months(CurrentDate())=Months(Start Month),((30+Days(CurrentDate()))-Days(Start
                    Day)),if(Months(CurrentDate("MMM-YY"))=Months(Expiration Month),Days(Expiration
                    Day)-Days(CurrentDate()),30))
    • Base Currency Amount
                    =If(lookup(currency,Currency Exchange,Currency
                    Code,Type)="",amount,ConvertCurrencyToBase(amount,currency,"Actual"))
    • Expiration =DateFormat(Expiration Day,"MMM d, yyyy")
    • Expiration Day =value(Split(Start Day,1,"-"))+value(term,"P#Y")&right(Start Day,6)
    • Expiration Month =Left(Expiration Day,8)&"01"
    • 
      Is Active =IF(Months(CurrentDate())>=Months(Start Month) AND
                    Months(CurrentDate())<=Months(Expiration Month),"Active","Inactive")
    • Provider ="Microsoft Azure"
    • Start =DateFormat(Start Day,"MMM d, yyyy")
    • Start Day =split(eventDate,1,"T")
    • Start Month =Left(Start Day,8)&"01"
    • Term in Years =value(term,"P#Y")
    • Total Effective Cost =If(Is Active="Active",(Base Currency Amount/360)*Active Days per Month,0)
  6. Ensure that the Type for each column is correct. All the columns should be labels, except for the following columns, which need to be numeric:
    • Active Days per Month
    • Base Currency Amount
    • Term in Years
    • Total Effective Cost
  7. Create another table called “Azure RI Purchases Cash-Based Transform.” On the Source step, click Existing Table >Azure RI Purchases Transform.
  8. Create a Formula step after the Existing Table step. Click Select column to edit >Total Effective Cost. Update the formula to:
    Total
                  Effective Cost =If(Months(CurrentDate())=Months(Start Month),Base Currency
                  Amount,"")
  9. Click Azure EA Detailed Bill Master Data, then select Check Out.
  10. On the Formulas step, add a new column with the following formula:
    Reservation
                  Order ID =IF(FIND("ReservationOrderId", AdditionalInfo)>0,
                  split((RIGHT(AdditionalInfo,LEN(AdditionalInfo)-FIND("ReservationOrderId",
                  AdditionalInfo)-(LEN("ReservationOrderId")+2))),1,""""), "")
  11. Click Cloud Service Provider Master Data, then click Check Out.
  12. On the Append step, click Edit on the Azure EA Detailed Bill Master Data. Click Select additional source columns. Click Reservation Order ID, then click Save.
  13. Click Reserved Instances Master Data, then click Check Out.
  14. On the Append step, click Append table.
  15. Append the Azure RI Purchases Transform table with the following mapping. Any fields not mentioned can be left blank:
    • Account ID =accountName (or any other column that may be more relevant for this field)
    • Active Days per Month =Active Days per Month
    • Amortized Upfront Cost =Total Effective Cost
    • Expiration Date =Expiration
    • Expiration Day =Expiration Day
    • Expiration Notification =30
    • Instance Count =quantity
    • Instance Type =armSkuName
    • Is Active =Is Active
    • Location =region
    • Offering =”All Upfront”
    • Product Code =”Virtual Machines”
    • Reserved Instance ID =reservationOrderId
    • Source =”Purchased”
    • Start Date =Start
    • Term Years =","=NumberFormat(Term in Years,""#,### Year"")"))
    • Total Effective Cost =Total Effective Cost
    • Upfront Price =Base Currency Amount
  16. Click Select additional source columns >Provider.
  17. Click Save.
  18. Append an additional table to Reserved Instances Master Data. Select Azure RI Purchases Cash-Based Transformwith the following mapping. Any fields not mentioned can be left blank:
    • Account ID =accountName (or any other column that may be more relevant for this field)
    • Active Days per Month =Active Days per Month
    • Amortized Upfront Cost =Total Effective Cost
    • Expiration Date =Expiration
    • Expiration Day =Expiration Day
    • Expiration Notification =30
    • Instance Count =quantity
    • Instance Type =armSkuName
    • Is Active =Is Active
    • Location =region
    • Offering =”All Upfront”
    • Product Code =”Virtual Machines”
    • Provider =Provider (this field will now be available if it was added as an additional column in the previous step)
    • Reserved Instance ID =reservationOrderId
    • Source =”Cost Allocation Report”
    • Start Date =Start
    • Term Years =","=NumberFormat(Term in Years,""#,### Year"")"))
    • Total Effective Cost =Total Effective Cost
    • UID Metafield =Source
    • Upfront Price =Base Currency Amount
  19. Click Save.
  20. We will now need to add “Provider” on the other appends. Click Edit on all of the remaining AWS appended tables. For Provider, put in the following value:
    ="Amazon Web Services, Inc.
  21. Click Save and check in all changes.

Configure allocation keys

Procedure

  1. Click the Reserved Instances object in the Project Explorer, then click Check Out.
  2. Click Add Allocation, then name the allocation “Reserved Instances Azure”.
  3. Add the following filter on the From step:
    Reserved Instances Master Data.Source Equals Purchased
  4. On the Allocate step, click the Cloud Invoice and Fixed RI Cost models.
  5. On the Using step, click Weighted Value.
  6. On the To step, click Cloud Service Provider.
  7. On the Distributing step, select Weight By and Weight by a Table column. Use the Cloud Service Provider Master Data.Usage Qty for the weighting column.
  8. Select Data Relationship. For the Source Column, use Reserved Instances Master Data.Reserved Instance ID”.
  9. For the Destination column, use Cloud Service Provider Master Data. Reservation Order ID.
  10. Click OK and check in the changes.

Update visibility and add provider on the Reserved Instances report

Procedure

  1. Navigate to the Reserved Instances report and check out the document.
  2. To update visibility settings so the reports render when only Azure data is loaded, click the Active Reserved Instances tab.
  3. Click Tabs > Visibility.
  4. In the Expiring Reservations tab, update the visibility formula to:
    <%=if(")!=0,"show",if(")!=0,"show",if(")>0,"show",if(")!=0,"show","hidden"))))%>
  5. Under Active Reserved Instances, click Cash Based.
  6. Click Tabs > Visibility, and update the visibility for the Amortization Based tab to:
    <%=if(")!=0,"show",if(")!=0,"show",if(")!=0,"show","hidden")))%>
  7. Click No Recurring Charges for Reserved Instances this month, then click Report > Visibility and update this visibility formula to:
    <%=if(")>0 OR ")>0 OR ")>0,"hidden","show")%>

    The visibility settings should now be updated. Next, we will want to add a slicer for “Provider”.

  8. Right-click the Cash Based tab, and select Send to back.
  9. Click Report > Compact Slicer, and drag the slicer box into the Cash Based tab group.
  10. In Project Explorer, click Tables > Reserved Instances. Drag Provider into the Slice by field in the Ad Hoc Query. Format and resize as needed.
  11. Repeat steps 9 and 10 for all other groups that have slicers within the Active Reserved Instances and Expiring Reservations tabs. (RI Purchase Recommendations is not yet configured to work with Azure).
  12. Click the RI Consumption tab. Create another compact slicer as before, but instead of pulling from Reserved Instances, drag Provider from under Cloud Services. Resize and format as needed.
  13. Go back to the Active Reserved Instances tab and right-click the Cash Based tab, then select Bring to front.
  14. Check in the changes.

Verify that Azure RI costs are flowing

After you complete all of the steps above, the Azure RI costs should be flowing in the Cloud Invoice and Fixed RI Costs models. You can validate this in a couple of places:

Procedure

  1. On the model, click Reserved Instances > Cloud Invoice. Validate that the driver into Reserved Instances included Azure Costs. In addition, validate that the Reserved Instances Azure allocation has the correct costs.
    The Reserved Instances object is built to include both cash-based and amortized costs to allow reporting on both. Therefore, if you are viewing a month where the Azure RI was purchased, the expected allocation is that the Reserved Instances object will include both the entire purchased amount and the amortized amount. However, only the amortized amount is allocated to Cloud Service Provider so that the correct values are displayed on the reports. Therefore, there will be fallout in the allocation between RIs and Cloud Service Provider.
  2. On the Reserved Instances report, validate that Azure RIs are appearing with the correct values.