이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 4. Integrate your Microsoft Azure account with data filtering


To share a subset of your billing data with Red Hat, you can configure a function script in Microsoft Azure.

This script will filter your billing data and export it to object storage so that cost management can then access and read the filtered data. Add your Microsoft Azure integration to cost management from the Integrations page.

Note
  • If you created an unfiltered Azure integration, do not complete the following steps. Your Azure integration is already complete.
  • Azure is a third-party product and its processes can change. The instructions for configuring third-party integrations are correct at the time of publishing. For the most up-to-date information, see Microsoft Azure’s documentation.
Warning

If you create a filtered integration and manually customize your data, you must manually send CSV files to cost management. If you fail to send the CSV files, cost management will not be able to provide you with any Red Hat Lightspeed or cost data. If you want an automatic process, do not select I wish to manually customize the data set sent to cost management in the wizard.

To create an Azure integration, you will complete the following tasks:

  1. Create a storage account and resource group.
  2. Configure Storage Blob Data Reader roles for access.
  3. Create a function to filter your data and send it to Red Hat.

4.1. Add your Microsoft Azure account as an integration

Add your Microsoft Azure account as an integration so that cost management can process the cost and usage data.

Prerequisites

  • You must have a Red Hat user account with Cloud Administrator entitlements.
  • You must have a service account.
  • Your service account must have the correct roles assigned in Hybrid Cloud Console to enable cost management access. For more information, see the User Access Configuration Guide.
  • The service account used to upload data must be added to a user group that has the cost management:settings:write permission. When configuring this in the Red Hat Hybrid Cloud Console, ensure that the group’s assigned role includes the cost-management application and the settings resource type with write operations enabled. This is required to access the Ingress Reports API for data uploads.

Procedure

  1. In cost management, navigate to Settings Menu Settings icon > Integrations > Cloud tab and click Add integration.
  2. In the Add a cloud integration wizard, select Microsoft Azure and click Next.
  3. Enter a name for your integration and click Next.
  4. In the Select application step, select Cost management and click Next.
  5. In the Specify cost export scope step, select I wish to manually customize the data set sent to Cost Management. If you are registering RHEL usage billing, select Include RHEL usage.
  6. Click Next.

Verification

  • In the Add a cloud integration wizard, verify that the customization option is selected.

4.2. Store cost data with a Microsoft Azure resource group and storage account

Create a storage account in Microsoft Azure to house your billing exports and a second storage account to house your filtered data.

Note

Your storage account must allow public network access for Cost Management to retrieve exported data. If your storage account uses private endpoints or restricted virtual networks, you must enable Red Hat’s IP addresses in your firewall and virtual network settings. For the list of allowed IP addresses to add to your Azure private storage account, see IP allowlist for Red Hat Hybrid Cloud Console and Red Hat Lightspeed notifications and integrations

Procedure

  1. In your link:https://azure.microsoft.com/en-usMicrosoft Azure account, enter "storage" in the search bar, click Storage accounts, and click Create.
  2. Complete the Azure wizard to create the storage account and copy the resource group and storage account names for later use.
  3. Click Review, review the storage account details, and click Create.
  4. In cost management, navigate to the Add a cloud integration wizard and paste the resource group and storage account names into Resource group name and Storage account name.

Verification

  • In your Microsoft Azure account, verify that the new storage account appears in the Storage accounts list with a status of Available.

4.3. Create a daily Microsoft Azure export schedule

Next, set up an automatic export of your cost data to your Microsoft Azure storage account before you filter it for cost management.

Procedure

  1. In your Microsoft Azure account, enter "cost exports" in the search bar, click the result, and click Create.
  2. In Select a template, click Cost and usage (actual) to export your standard usage and purchase charges.
  3. Follow the Azure wizard steps:

    • Create a new resource group and storage account or select existing ones.
    • Set Format to CSV.
    • Set Compression type to None or Gzip.
  4. Review the information, click Create, and return to the Add a cloud integration wizard in cost management.
  5. Click Next.

Verification

  • In your Microsoft Azure account, verify that the export appears in the Cost exports list with a status of Active.

4.4. Add your Microsoft Azure subscription ID to the cost management integration wizard

Find your subscription_id in the Microsoft Azure Cloud Shell and add it to the Add a cloud integration wizard in cost management.

Procedure

  1. In your Microsoft Azure account, open Cloud Shell and run the following command:

    az account show --query "{subscription_id: id }"
  2. Copy the returned subscription_id value:

    Example response:

    {
        "subscription_id": 00000000-0000-0000-000000000000
        }
  3. In cost management, navigate to the Subscription ID field of the Add a cloud integration wizard, paste the value, and click Next.

Verification

  • In the Add a cloud integration wizard, verify that the subscription ID appears in the Subscription ID field.

4.5. Create Microsoft Azure roles for Red Hat access

To grant Red Hat access to your data, you must configure dedicated roles in Microsoft Azure. If you have an additional resource under the same Azure subscription, you might not need to create a new service account.

Procedure

  1. In cost management, navigate to the Roles section of the Add a cloud integration wizard and copy the az ad sp create-for-rbac command.
  2. In your Microsoft Azure account, open Cloud Shell, paste and run the command.
  3. Copy the returned values for client ID, secret, and tenant:

    Example response:

    {
        "client_id": "00000000-0000-0000-000000000000",
        "secret": "00000000-0000-0000-000000000000",
        "tenant": "00000000-0000-0000-000000000000"
    }
  4. In cost management, return to the wizard, paste the values into their corresponding fields on the Roles page, and click Next.
  5. Review your information, click Add, and copy the Source UUID from the pop-up screen for your function script.

Verification

  • In cost management, navigate to Settings Menu Settings icon > Integrations and verify that your Microsoft Azure integration appears in the list.

4.6. Create a function to filter your data and add it to a storage account

Creating a function in Azure filters your data and adds it to the storage account that you created to share with Red Hat. You can use the example Python script in this section to gather and share the filtered cost data from your export.

Prerequisites

  • You must have Visual Studio Code installed on your device.
  • You must have the Microsoft Azure functions extension installed in Visual Studio Code. To create an Azure function, Microsoft recommends that you use their Microsoft Visual Studio Code IDE to develop and deploy code. For more information about configuring Visual Studio Code, see Quickstart: Create a function in Azure with Python using Visual Studio Code .

Procedure

  1. In your Microsoft Azure account, enter functions in the search bar, select Function App, and click Create.
  2. Select a hosting option, click Select, add your resource group, and configure the instance details:

    1. Name your function app.
    2. Set Runtime stack to Python and Version to latest.
  3. Click Review + create, then click Create. After creation completes, click Go to resource.
  4. In Visual Studio Code, open the Microsoft Azure tab, sign in, and create a new function:

    1. Click Azure Functions in the Workspaces drop-down and click Create Function.
    2. Follow the prompts to select Python, Model 2, and the latest version.
    3. Select Timer trigger template, name the function, and set the cron expression (for example, 0 9 * * * for daily at 9 AM).
    4. Click Create and Open in the current window.
  5. In the development environment, open requirements.txt, add the required dependencies (azure-functions, pandas, requests, azure-identity, azure-storage-blob), and save.
  6. Copy the Python script and paste it into function_app.py.
  7. Update the script configuration:

    1. Change the values in # Required vars to update to match your environment.
    2. Ensure the cron timer matches @app.timer_trigger in the script.
    3. Uncomment either filtered_data = hcs_filtering(df) or filtered_data = rhel_filtering(df) for your filtering type.
  8. If using custom filtering, ensure the script includes all required columns and follows the column normalization pattern in the example script. Update the custom query under # custom filtering basic example #.
  9. Save the file, right-click the Function window in Visual Studio Code, click Deploy to Function App, and select your function app.

Verification

  • In your Microsoft Azure account, navigate to your function app and verify that the function appears in the Functions list with a status of Enabled.
  • Check the Monitor section to verify that the function runs successfully according to the configured schedule.

4.7. Set up your credentials in Azure

Create two new secrets for your service account: client_id and client_secret.

For help with steps in Azure, see Microsoft’s documentation: Azure Key Vault.

Procedure

  1. In your Microsoft Azure account, navigate to Key Vaults and click Create.
  2. Select the resource group that your function is in and follow the Azure wizard to create a new secret:

    1. In Key vault name, enter any name of your choosing.
    2. In Access policies, click Create new policy and select Secret Management from the templates.
    3. In the Principal tab, search for and select your function as the principal.
  3. After completing the wizard, click Create Vault. When the deployment completes, click Go to resource to open the Key Vault page.
  4. In the Objects drop-down, select Secrets.
  5. Create the first secret for your service account:

    1. Click Generate/import.
    2. In Create a secret, enter a name for your client_id.
    3. Copy the Secret Identifier value for later use.
  6. Repeat the previous step to create a second secret for your client_secret.

Verification

  • In the Key Vault page, verify that both client_id and client_secret secrets appear in the Secrets list.

4.8. Add your credentials to your Azure function

Next, go to your function in Microsoft Azure and enter information about your secrets.

Procedure

  1. In your Microsoft Azure account, navigate to your function and select Settings Environment variables.
  2. Click Add, configure the first environment variable, and click Save:

    • Name: ClientIdFromVault
    • Value: @Microsoft.KeyVault(SecretUri=YOUR-CLIENT-ID-URI) (replace YOUR-CLIENT-ID-URI with the Secret Identifier value that you copied previously)
  3. Repeat the process for the second environment variable:

    • Name: ClientSecretFromVault
    • Value: @Microsoft.KeyVault(SecretUri=YOUR-CLIENT-SECRET-URI) (replace YOUR-CLIENT-SECRET-URI with the Secret Identifier value that you copied previously)

Verification

  • In your Microsoft Azure function’s Environment variables page, verify that both ClientIdFromVault and ClientSecretFromVault appear in the environment variables list.

4.9. Configure function roles for cost data access

Configure dedicated credentials to grant your function blob access to Microsoft Azure cost data. These credentials enable your function to access, filter, and transfer the data from the original storage container to the filtered storage container.

Procedure

  1. In your Microsoft Azure account, enter functions in the search bar and select your function.
  2. In the Settings menu, navigate to Identity > System assigned tab, switch Status to On, and click Save.
  3. Complete the following steps for each of the two storage accounts that you created:

    1. Click Azure role assignments and then click Add role assignment.
    2. Set Scope to Storage, select one of your storage accounts in Resource, set Role to Storage Blob Data Contributor, and click Save.
    3. Click Add role assignment again.
    4. Set Scope to Storage, select the same storage account in Resource, set Role to Storage Queue Data Contributor, and click Save.
    5. Repeat steps 3-4 for the second storage account.

Verification

  • In your Microsoft Azure function’s Identity page, verify that the Azure role assignments section shows four role assignments: two for each storage account (Storage Blob Data Contributor and Storage Queue Data Contributor).

You have now successfully created a filtered integration. To learn more about what you can do with your data, continue to Next steps for managing your costs.

Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동