Adding a Microsoft Azure source to cost management

Cost Management Service 2021

Learn how to add and configure your Microsoft Azure sources

Red Hat Customer Content Services

Abstract

This guide describes how to add a Microsoft Azure source to cost management.

Chapter 1. Adding a Microsoft Azure source to cost management

Configure your Microsoft Azure account to allow cost management access.

Configuring your Azure account to be a cost management source requires:

  1. Creating a storage account and resource group
  2. Configuring a Storage Account Contributor and Reader roles for access
  3. Scheduling daily cost exports
Note

As non-Red Hat products and documentation can change without notice, instructions for configuring the third-party sources provided in this guide are general and correct at the time of publishing. See the Microsoft Azure documentation for the most up-to-date and accurate information.

Add your Azure source to cost management from https://cloud.redhat.com/settings/sources/.

1.1. Creating an Azure resource group and storage account

Cost export data is written to a storage account, which exists within a resource group. The resource group must be accessible by cost management in order to read the Azure cost data.

Create a new storage account in Azure to contain the cost data and metrics that cost management will collect. This requires a resource group; Red Hat recommends creating a dedicated resource group for this storage account.

Note

You must have a Red Hat account user with Sources Administrator entitlements before you can add sources to cost management.

  1. In the cloud.redhat.com platform, open the Sources menu (https://cloud.redhat.com/settings/sources/) to begin adding an Azure source to cost management:

    1. Navigate to Sources and click Add a source to open the Sources wizard.
    2. Enter a name for your source and click Next.
    3. Select cost management as the application and Microsoft Azure as the source type. Click Next.
  2. Create a resource group and storage account in your Azure account using the instructions in the See Azure documentation Create a storage account.

Make a note of the resource group and storage account. They will be needed in subsequent steps.

  1. In the cloud.redhat.com Sources wizard, enter the Resource group name and Storage account name and click Next.

1.2. Configuring Azure roles

Red Hat recommends configuring dedicated credentials to grant cost management read-only access to Azure cost data. Configure a Storage Account Contributor and Reader role in Azure to provide this access to cost management.

  1. In Azure Cloud Shell, run the following command to obtain your Subscription ID:

    $ az account show --query "{subscription_id: id }"
  2. In the cloud.redhat.com Sources wizard, enter your Subscription ID. Click Next to move to the next screen.
  3. In Azure Cloud Shell, run the following command to create a cost management Storage Account Contributor role, and obtain your tenant ID, client (application) ID, and client secret:

    $ az ad sp create-for-rbac -n "CostManagement" --role "Storage Account Contributor" --query '{"tenant": tenant, "client_id": appId, "secret": password}'
  4. In the cloud.redhat.com Sources wizard, enter your Azure Tenant ID, Client ID, and Client Secret.
  5. In Azure Cloud Shell, run the following command to create a cost management Reader role with your subscription ID. Copy the full command from the cloud.redhat.com Sources wizard, which will automatically substitute your Azure subscription ID obtained earlier for <SubscriptionID>:

    $ az role assignment create --role "Cost Management Reader" --assignee http://CostManagement --subscription <SubscriptionID>
  6. Click Next.

1.3. Configuring a daily Azure data export schedule

Create a recurring task to export your cost data on a daily basis automatically to your Azure storage account, where cost management will retrieve the data.

Note

Cost management requires a data export from a Subscription level scope. You must create the cost data export from Subscriptions. For more information about how scopes work in Azure, see Understand and work with scopes in the Azure documentation.

  1. In Azure, add a new export as described in the instructions in the Azure article Create and manage exported data.

    • For Export type, select Daily export of billing-period-to-date costs.
    • For Storage account, select the account you created earlier.
    • Enter any value for the container name and directory path for the export. These values provide the tree structure in the storage account where report files are stored.
    • Click Run now to start exporting data to the Azure storage container.
  2. In the cloud.redhat.com Sources wizard, click Next when you have created the export schedule and review the source details.
  3. Click Finish to complete adding the Azure source to cost management.

After the schedule is created, cost management will begin polling Azure for cost data, which will appear on the cost management dashboard (console.redhat.com/openshift/cost-management/).

Chapter 2. Next steps for managing your costs

After adding your OpenShift Container Platform and Microsoft Azure sources, in addition to showing cost data by source, cost management will automatically show Azure cost and usage related to running your OpenShift Container Platform clusters on their platform.

On the cost management Overview page (console.redhat.com/openshift/cost-management/), your cost data will be sorted into OpenShift and Infrastructure tabs. From here, you can use Perspective to select different views of your cost data.

You can also use the left navigation menu to view the additional details of your costs by service.

2.1. Limit access to cost management resources

After adding and configuring sources in cost management, it is a good idea to limit access to cost data and resources. For example, you may not want users to have access to all cost data, but instead only data specific to their projects or organization. Using role-based access control, you can limit the visibility of resources involved in cost management reports. For example, you may want to restrict a user’s view to only AWS sources, instead of the entire environment.

For more information about limiting access see, Limiting access to cost management resources.

2.2. Configure tagging for your sources

The cost management application tracks cloud and infrastructure costs using tags (called labels in OpenShift), which you can refine to filter and attribute to resources. Tags in cost management allow you to organize your resources by cost and to allocate the costs to different parts of your cloud infrastructure.

Important

Tags and labels can only be configured directly on a source. While you can choose what tags are activated in cost management, you cannot edit tags and labels in the cost management application.

See Managing cost data using tagging to learn more about:

  • Planning your tagging strategy to organize your view of cost data.
  • Understanding how cost management associates tags.
  • Configuring tags and labels on your sources.

2.3. Configure cost models to accurately report costs

Now that you have configured your sources to collect cost and usage data into cost management, you can configure cost models to associate prices to metrics and usage, and fine-tune the costs of running your cloud.

A cost model is a framework used to define the calculations for the costs stored in cost management, using raw costs and metrics. Costs generated by a cost model can be recorded, categorized and distributed to specific customers, business units or projects.

From the Cost Models area of cost management, you can:

  • Classify your costs as infrastructure or supplementary costs.
  • Capture monthly costs for OpenShift nodes and clusters.
  • Apply a markup to account for additional support costs.
  • Learn how to configure a cost model in Using cost models.

2.4. Use the Cost Explorer to visualize your costs

The cost management Cost Explorer allows you to create custom graphs of time-scaled cost and usage information to better visualize and interpret your costs.

See Visualizing your costs using Cost Explorer to learn more about:

  • Using Cost Explorer to identify abnormal events.
  • Understanding how your cost data changes over time.
  • Creating custom bar charts of your cost and usage data.
  • Exporting custom cost data tables.

Legal Notice

Copyright © 2021 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.