Connecting Azure Cost Management

Step-by-step guide on how to enable Azure Cost Management

In order to provide PerfectScale with access to your Azure pricing using default authentication with the Azure SDK, the following data should be provided:

azure_client_id

azure_tenant_id

azure_client_subscription

PerfectScale has created a detailed guide to help you access the credentials effortlessly.

How to get client_id and tenant_id

  1. In the left-hand menu, navigate to Microsoft Entra ID.

  2. Under Manage, select App registrations.

  3. Click + New registration at the top.

    New app registration
  4. Enter a name for your application, for example, MyAppPerfectScale.

  5. Choose the supported account type. Typically, a Single tenant is used.

  6. Click Register.

    New app registration form
  7. After registering, you’ll be redirected to the application overview page.

    1. Copy the Application (client) ID – this is your azure_client_id.

    2. Copy the Directory (tenant) ID – this is your azure_tenant_id.

    Credentials

How to get client_subscription

  1. In the Azure Portalarrow-up-right, navigate to Subscriptions in the left-hand menu.

  2. Select the subscription you want to use.

  3. Copy your Subscription ID (azure_client_subscription) from the overview page.

    Subscription ID

How to configure access to Azure without secrets

  1. In the application’s Certificates & secrets section, go to Federated credentials and click +Add credential.

    Add credential
  2. Configure the following settings:

    Edit a credential

How to get client_secret

client_secret is the secret key that allows the application to authenticate to Azure AD and get an access token to Azure resources. Follow the instructions below to get the credentials.

  1. In the application’s Certificates & secrets section, go to Client secrets.

  2. Click + New client secret.

    New client secret
  3. Add a description, for example, Secret for PerfectScale, and set an expiry period as needed.

  4. Click Add.

    Add a client secret
  5. ‼️Copy the Value (your azure_client_secret) immediately, as it will only be displayed once‼️

How to grant permissions to your application

circle-info

Ensure you provide PerfectScale with the necessary permissions, as this step is mandatory.

  1. In the Azure Portalarrow-up-right, navigate to Subscriptions in the left-hand menu.

  2. Select the subscription you want to use.

  3. In the left-hand menu, choose Access Control (IAM).

    Access control
  4. Navigate to Role assignments.

  5. Press + Add and choose Add role assignment.

    Add role assignment
  6. In the Role section, select Reader role and click Next.

    Reader role
  7. In the Members section, click Select Members and use the right-hand search menu to find your application (e.g., “MyApp”).

    • You can also search the application using Object ID.

    Application search
  8. Click Review + Assign.

Once you have all the credentials needed, you need to create an Azure Profile and apply it to the desired cluster.

Configuring Azure pricing integration with Azure profile

🛠️ How to create Azure Billing profile

There are two options for creating a Profile: from the Settings tab or directly from the Overview.

From the Settings tab

Go to the Settings tab on the left panel -> select Pricing -> click the +Add Profile button -> select Azure Billing -> name the profile and put the needed values in the relevant fields -> click Save button.

Azure profile from the settings

From the Overview tab

Go to the Overview tab on the left panel -> find the cluster to which you want to apply the Azure Profile and click gear button -> go to Customizations -> click on Add New Profile in the Pricing Profile drop-down list -> select Azure Billing type -> name and configure your profile -> click the Save And Apply button -> click the Save Changes button.

Azure profile from the overview

Azure Billing profile configuration

Azure profila configuration

azure_subscription_id: The unique identifier assigned to your Azure subscription that allows PerfectScale to interact with Azure resources within your subscription. Click here to learn how to get it.

azure_tenant_id (Directory (tenant) ID): The unique identifier of the organization in Azure Active Directory that allows Azure to manage authentication within the specific directory. Click here to learn how to get it.

azure_client_id (Application (client) ID): The unique identifier assigned to your application that allows it to access Azure resources. Click here to learn how to get it.

azure_auth_type: The Azure authentication method . By default, PerfectScale specifies workload_identity .

circle-info

We recommend using workload_identity for azure_auth_type. Alternatively, you can authenticate using client_secret, but you'll also need to specify azure_client_secret. Click here to learn how to get it.

Global discount for on-demand nodes

If you have a global discount for on-demand nodes (from a cloud provider or cloud reseller) that isn’t included in your custom cloud billing, you can apply it in addition to your Azure Cost Management integration.

Add the following parameters to your Azure Billing profile to enable applying the globalDiscount on top of your cloud billing integration:

global_discount (optional block):

  • percentage - the percentage (0–100, floats supported) of the discount to apply on top of standard on-demand node pricing. This field is required when global_discount exists.

  • start_date (optional) - the effective start date for applying the global_discount. If this field is empty, it defaults to today.

circle-info

If you change the percentage or start_date, only newly generated Trends report will reflect the update. Historical reports will not update automatically. Contact [email protected]envelope if you need them recalculated.

The complete configuration might look like the following example:

Azure Billing configuration verification

To verify if Azure Cost Management is configured properly, click the Test Integration button.

🟢 When the configuration is correct, you will see the message Azure Configured Correctly.

🔴 In case of Azure Configured Wrongly response, check the Show integration failure details dropdown and fix the displayed issues.

Wrong Azure profile configuration

🛠️ How to apply Azure Billing profile

Apply to a single cluster

To apply Azure Billing Profile to the cluster, go to the Overview tab on the left-hand panel -> find the cluster to which you want to apply the Azure Billing Profile and click gear dots button -> go to Customizations -> select the needed profile in the Pricing Profile drop-down list.

Applying a single Azure profile to the cluster

Apply to multiple clusters

To apply the profile to multiple clusters from a single view, use the Manage Assignments feature.

Go to the Settings tab on the left-hand panel -> select the Pricing -> click the Manage Assignments button -> apply the profile for the needed clusters -> click the Save Changes button.

Applying Azure profile to multiple clusters

Configuring Azure pricing integration with CRD

To configure Azure pricing using a Custom Resource Definition (CRD), you’ll need to define and apply a Custom Resource (CR) that specifies your unique billing conditions. This approach allows you to manage accurate pricing directly through Kubernetes manifests.

circle-exclamation

Setup instructions

  1. Set up Azure billing export in your subscription.

  2. Create an Azure AD application and service principal.

  3. Grant the application the necessary permissions to access billing data.

  4. Generate a client secret for the application (if using client_secret authentication).

  5. Copy the client ID, tenant ID, subscription ID, and client secret to the configuration below.

We recommend configuring a CR using workload_identity for azure_auth_type.

Configure the CR:

⚙️ CR parameters:

Parameter
Description

global_discount (optional block)

The discount to apply on top of standard on-demand node pricing. percentage - the percentage (0–100, floats supported) of the discount. This field is required when global_discount exists. start_date (optional) - the effective start date for applying the global_discount.

azure_auth_type

The Azure authentication method.

azure_client_id

The application (client) ID assigned to your application when it was registered in Azure Active Directory.

azure_subscription_id

The unique identifier for your Azure subscription.

azure_tenant_id

The unique identifier for your Azure Active Directory (AAD) tenant.

circle-exclamation

Alternatively, you can configure a CR using the client_secret.

Apply the Azure Client Secret first (only needed for authentication with client_secret):

circle-info

Ensure that the secret is created in the same namespace as the exporter - perfectscale.

Configure the CR:

⚙️ CR parameters:

Parameter
Description

global_discount (optional block)

The discount to apply on top of standard on-demand node pricing. percentage - the percentage (0–100, floats supported) of the discount. This field is required when global_discount exists. start_date (optional) - the effective start date for applying the global_discount.

azure_auth_type

The Azure authentication method.

azure_client_id

The application (client) ID assigned to your application when it was registered in Azure Active Directory.

azure_subscription_id

The unique identifier for your Azure subscription.

azure_tenant_id

The unique identifier for your Azure Active Directory (AAD) tenant.

azure_client_secret_from

The client secret for authentication (when using client_secret authentication type).

circle-exclamation

Last updated

Was this helpful?