Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
FinOps Handbook for Microsoft Azure

You're reading from   FinOps Handbook for Microsoft Azure Empowering teams to optimize their Azure cloud spend with FinOps best practices

Arrow left icon
Product type Paperback
Published in May 2023
Publisher Packt
ISBN-13 9781801810166
Length 256 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Maulik Soni Maulik Soni
Author Profile Icon Maulik Soni
Maulik Soni
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. Part 1: Inform
2. Chapter 1: Bringing Visibility and Allocating Cost FREE CHAPTER 3. Chapter 2: Benchmarking Current Spend and Establishing Budgets 4. Chapter 3: Forecasting the Future Spend 5. Chapter 4: Case Study – Beginning the Azure FinOps Journey 6. Part 2: Optimize
7. Chapter 5: Hitting the Goals for Usage Optimization 8. Chapter 6: Rate Optimization with Discounts and Reservations 9. Chapter 7: Leveraging Optimization Strategies 10. Chapter 8: Case Study - Realize Savings and Apply Optimizations 11. Part 3: Operate
12. Chapter 9: Building a FinOps Culture 13. Chapter 10: Allocating Costs for Containers 14. Chapter 11: Metric-Driven Cost Optimization 15. Chapter 12: Developing Metrics for Unit Economics 16. Chapter 13: Case Study – Implementing Metric-Driven Cost Optimization and Unit Economics 17. Index 18. Other Books You May Enjoy

Cost allocation in Azure for FinOps

The goal of the FinOps team is to create visibility into cloud spending and enable granular cost allocation to create shared accountability of cloud spending. Proper cost allocation will help teams to see their cloud spending and the impact their action or inaction has on the bill. Spending data must be properly mapped to the organizational hierarchy by cost center, applications, and business units by using the account hierarchy and resource tagging.

Cost allocation using the account, management group, and subscriptions hierarchy

The billing account, department, and account hierarchy for an Enterprise Agreement offer type allows you to organize and allocate your costs at the highest level. In the following example, the organization has created two departments (Marketing and HR) under Billing Account. Invoices are generated at the Billing Account level. The Department part groups the accounts (that contain subscriptions) to organize costs into a logical grouping. The EA admin can configure the spending quota for each department. This is an excellent place to implement a budget. The enterprise administrator and the department administrator will receive notifications once the quota has reached 50%, 75%, 90%, and 100%.

Figure 1.9 – Azure Enterprise Agreement’s department hierarchy

Figure 1.9 – Azure Enterprise Agreement’s department hierarchy

While you can use Enterprise Agreement’s Department hierarchy for cost allocation, in practice, it does not provide the granularity that the FinOps team is looking for.

Note

To learn more about the Microsoft Customer Agreement (MCA) billing hierarchy, please refer to the Microsoft documentation at https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/view-all-accounts.

Here, management groups come into the picture. As you can see in Figure 1.10, we are starting from the top and moving down toward a bit more granularity. Management groups allow efficient access, policy, and compliance for hundreds of subscriptions. While they are not directly related to helping with cost allocation, the latest cost analysis scope object now includes filtering by using management groups. So, now, you can group the cost of all resources under a single management group and report it back to the business. The following is an example of a management group hierarchy that helps with cost allocation:

Figure 1.10 – Organizing subscriptions under management groups

Figure 1.10 – Organizing subscriptions under management groups

In the preceding example, the first level of management group is called the Root management group. Management groups can be six levels deep. Under Root, we have Organization, and under Organization, we have Platform, Landing Zone, Decommissioned, and Sandbox management groups. Under the Platform management group, we have Identity, Management, and Connectivity. Each has a corresponding Subscriptions group.

Using this management group structure, the FinOps team can easily group the cost by a given management group. For example, to know how much the SAP workload costs, you can go to the Cost Analysis dashboard and select the scope of the SAP management group. That will include all the subscriptions under SAP and provide the total cost.

Subscriptions in Azure support tags. To allocate cost at the subscription level, you can assign tags to the subscription and group the cost by the given tag. For example, by using tags on subscriptions, you can easily allocate and get the total cost incurred by a given tag on a subscription.

Cost allocation using resources tags

Tags are essentially metadata that you can apply to Azure resources in the form of key/value pairs. For example, if you want to distinguish the cost of the development environment from the production environment for the marketing application, you can assign the Environment = Development or Environment = Production tag to all the resources in Azure.

It is important to note that each resource, resource group, and subscription can have a maximum of 50 tags. If you need more than 50 tags, you can use a JSON string in the tag value. Also, note that Azure Automation, Azure Content Delivery Network (CDN), and Azure DNS (zone and A records) only support a maximum of 15 tags.

Note

Not all resource types in Azure support tags; these resources are called untaggable. To find out whether a resource supports tags or not, refer to the Microsoft documentation at https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/tag-support. Please see the case study for the strategy to allocate costs for untagged or untaggable resources.

Depending on the FinOps team’s maturity level, the following are the minimum tags that should be applied to the resources. To enforce tag coverage, you can create an Azure policy to audit or deny the resource creation if the required tags are not provided:

Tag Name

Description

appid

appid can be any unique ID that an organization can use to distinguish applications. The most common values are application IDs from CMDB, as in the following example:

appid = 141788

env

This represents the application environment, as in the following examples:

env = dev

env = prod

department

This represents the department that owns the application for billing purposes, as in the following example:

department = marketing

itowner

This represents the IT owner of the application, as in the following example:

itowner=james@corp.com

businessowner

This represents the business owner of the application, as in the following example:

businessowner=mike@corp.com

costcenter

This represents the organization’s cost center code for this application, as in the following example:

costcenter=10101

There are various ways you can apply these tags to Azure resources. The most common and effective way is to embed tags in your infrastructure as code (IaC) solution (Bicep or Terraform). Alternatively, you can use the Azure portal or Azure CLI commands to list, add, update, or delete tags.

To add tags to a Terraform template for a resource group, use the following code:

resource "azurerm_resource_group" "rg-dev" {
  name     = "rg-marketing-website-dev"
  location = "eastus"
  tags = {
    appid = "141788"
    env = "dev"
    department = "marketing"
    costcenter = "10101"
    itowner = "james@corp.com"
    businessowner = "charles@corp.com"
  }
}

To manage tags with PowerShell and Azure CLI commands, please check out the Microsoft documentation at https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources.

In the next section, we will look at how to view the allocated cost by tag using Azure’s cost analysis tool.

You have been reading a chapter from
FinOps Handbook for Microsoft Azure
Published in: May 2023
Publisher: Packt
ISBN-13: 9781801810166
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image