Book Image

FinOps Handbook for Microsoft Azure

By : Maulik Soni
Book Image

FinOps Handbook for Microsoft Azure

By: Maulik Soni

Overview of this book

To gain a competitive edge in today's unpredictable economic climate, you’ll need to unravel the mystery of saving costs on Microsoft Azure Cloud. This book helps you do just that with proven strategies for building, running, and sustaining repeated cost optimization initiatives across your organization. You’ll learn how to collaborate with finance, procurement, product, and engineering teams to optimize your cloud spend and achieve cost savings that can make a significant impact on your bottom line. The book begins by showing you how to effectively monitor and manage your cloud usage, identify cost-saving opportunities, and implement changes that’ll reduce your overall spend. Whether you're a small start-up or a large enterprise, this book will equip you with the knowledge and skills needed to achieve cost savings and maintain a lean cloud infrastructure. As you advance, you'll find out how to benchmark your current cloud spend and establish a budget for cloud usage. Throughout the chapters, you’ll learn how to negotiate with your cloud provider to optimize your rate, allocate cost for the container, and gain a solid understanding of metric-driven cost optimization. By the end of this FinOps book, you’ll have become proficient in Azure Cloud financial management with the help of real-world examples, use cases, and scenarios.
Table of Contents (19 chapters)
1
Part 1: Inform
6
Part 2: Optimize
11
Part 3: Operate

Exploring cost analysis in the Azure portal

Microsoft Azure has the most advanced, free, in-portal capability to analyze the cost of your workload. Let’s look at the Cost Management + Billing feature in the portal. You will learn how to do the following:

  • Identify the offer type for your subscription(s)
  • View the accumulated and forecasted cost
  • View the cost grouped by service
  • View the cost grouped by management group
  • View the cost grouped by tag
  • View the create, save, and share custom cost analysis views

Let’s look at how to accomplish these tasks using the Azure Cost Management + Billing feature in the portal.

Identifying the offer type for your subscription(s)

When you purchase or create a Microsoft Azure subscription, an Azure offer governs the payment terms and conditions, service rate, exclusions, payment options, cancellation policy, and service agreement between your organization and Microsoft. Here is how you can find out the offer type in the Azure portal:

  1. Open the Microsoft Edge browser.
  2. Navigate to https://portal.azure.com/#view/Microsoft_Azure_CostManagement/Menu/~/overview and then click on Cost Analysis.
  3. Click on Properties, under the Settings section. The Type field indicates your subscription’s offer type. The following screenshot shows that the subscription has an MCA offer type.
Figure 1.11 – Azure Cost Management + Billing

Figure 1.11 – Azure Cost Management + Billing

There are many different types of offers available in Azure. To view the full list and details about each offer, please check out https://azure.microsoft.com/en-us/support/legal/offer-details/.

Accumulated and forecasted cost

One of the most common requests from the finance and procurement team is to provide accumulated and forecasted costs for the workloads running in Azure. To accomplish this request, you can use the built-in accumulated cost view. Furthermore, you can share the view directly with the finance and procurement team or export the data in PNG, Excel, or CSV format for further analysis. The forecasted cost is based on your historical resource usage and shows a prediction of your estimated cost for up to a year.

Open Cost Management + Billing in the Azure portal and then click on Cost Analysis. The default Cost Analysis view will display actual and forecasted costs.

Figure 1.12 – The Azure Cost Analysis feature

Figure 1.12 – The Azure Cost Analysis feature

Since this is the first time we are looking at Cost Management + Billing, let’s get familiar with its key features:

  1. You can create many different views with customizations such as date ranges, scope, filter by service or tag, group by location or resource, and so on. Then, using the Save button at the top, you can create a new customized view.
  2. To share the view directly, use the Share button. It provides a direct URL to the cost management view. Remember that appropriate RBAC permissions will be required for the viewer to access the report.
  3. Using the Download button, you can download the image or data (as a CSV or Excel file) and share it with others.
  4. The Scope filter allows you to restrict the cost analysis to a subscription or management group.
  5. The VIEW dropdown shows built-in views such as accumulated cost, daily cost, cost by service, and any custom views that you may have saved earlier.
  6. The date range filter provides options to view your costs daily, monthly, quarterly, or yearly, or select a custom date range.
  7. The ACTUAL COST (USD) option shows the total cost. For Enterprise Agreement accounts, this includes all usage, reservations, and marketplace purchases.
  8. The FORECAST: CHART VIEW ON option shows the predicted cost based on your usage in the past.
  9. The dark color shows your accumulated cost.
  10. The light color shows your forecasted cost.

Now, you can provide the actual resource cost by selecting the right scope and date range.

We will take a deeper look at forecasting cost in Chapter 3, Forecasting the Future Spend.

Cost grouped by service

In this task, we will drill down the cost to the service level to better understand the parts of your infrastructure that cost more. This view helps you understand the primary cost drivers and enables you to adjust the service usage to control the cost:

  1. Open Cost Management + Billing in the Azure portal and then click on Cost Analysis.
  2. Change the view to CostByService and select the appropriate date range.
Figure 1.13 – Cost grouped by services

Figure 1.13 – Cost grouped by services

  1. Set the view to Table to see the data in table format.

Often, you will want to see the networking (virtual network, bandwidth, and so on) versus compute versus storage cost. This view provides all these details and enables you to create custom reports by exporting data into Excel.

Cost grouped by management group

Management groups in Azure provide you with an efficient way to manage resources, access, policies, and compliance by logically grouping the subscriptions. The management group hierarchy has also extended to Cost Management + Billing. Now, the cost management scope filter supports management group-based filtering. Let’s look at an example. The engineering vice president wants to know how much money we are spending to host corporate intranet applications versus customer-facing online business applications to calculate the overhead cost. To provide this data, follow these steps:

  1. Open Cost Management + Billing in the Azure portal and then click on Cost analysis.
  2. Change the Scope filter to -corp management group under the landing zone. This will provide costs for all the subscriptions hosting internal corporate applications.
Figure 1.14 – Root management group

Figure 1.14 – Root management group

  1. To provide the cost for online business-facing applications, change the scope to the online management group under the landing zone.
Figure 1.15 – Child management group

Figure 1.15 – Child management group

Please note that the aforementioned steps assume you have organized your subscriptions into management groups according to the Microsoft WAF guidance. More details are available at https://docs.microsoft.com/en-us/learn/modules/enterprise-scale-introduction/3-enterprise-scale-architecture-approach.

Cost grouped by tag

As you have seen previously, in Azure, you can use resource tags to allocate costs. After careful planning, your team has set up appropriate tags for the workload. In this example, the env:dev or env:prod tag has been applied to each resource in the dev and prod subscriptions for the marketing website’s workload. Now, for the annual budget planning, the finance team is asking you to provide costs for the dev and production environments. Here is how you can accomplish this task:

  1. Open Cost Management + Billing in the Azure portal and then click on Cost Analysis.
  2. Click on the Group by dropdown, then select Tag as a filter. Next, select a given tag to group by the cost. In this case, I have selected the env tag, which contains values such as dev and prod.
Figure 1.16 – Cost grouped by the env tag

Figure 1.16 – Cost grouped by the env tag

Note that when you group the cost by tag, you will see the Untagged category. This is because there are untagged resources in your subscription. Later, we will discuss how to deal with untagged and untaggable resources since, practically, it is not possible to tag 100% of resources all the time.

Creating, saving, and sharing custom cost analysis views

Finally, you want to create custom views and share them with the FinOps team to standardize the cost showback across teams. You can create private views that only you can see, as well as shared views. Shared views are accessible to anyone who has cost management access. To edit or delete a shared view, you will need cost management contributor access.

The finance team is asking for a standardized report that shows quarterly spending by service in the Azure US West 2 region for showback purposes. This is how you can accomplish the task:

  1. Open Cost Management + Billing in the Azure portal and then click on Cost Analysis.
  2. Click on the VIEW dropdown and select CostByService.
  3. Change Time Range to This Quarter.
  4. Click on Add filter, then select Location from the drop-down list. For Value, select US West 2. For Chart Type, select Column (stacked).
Figure 1.17 – Cost by services custom view

Figure 1.17 – Cost by services custom view

  1. To save this view so that team members can access it, click on Save as on the top toolbar:
Figure 1.18 – Save the custom dashboard

Figure 1.18 – Save the custom dashboard

  1. To share the view via a direct URL, click on Share.

The shared views will then appear under the VIEW dropdown of the Cost Analysis page. That concludes this chapter. Let’s recap what we’ve learned so far.