Azure Forecast

Azure Forecast

Certified

Forecast Azure spend with Cost Management

Calls the Cost Management Forecast - Usage API on a scope for an explicit period and returns the daily forecast and its total. Forecast only supports a custom period with daily granularity, so there is no timeframe or granularity to choose.

yaml
type: io.kestra.plugin.azure.billing.Forecast

Forecast the actual cost of the next 30 days and log it.

yaml
id: azure_cost_forecast
namespace: company.finops

tasks:
  - id: forecast
    type: io.kestra.plugin.azure.billing.Forecast
    scope: "/subscriptions/{{ secret('AZURE_SUBSCRIPTION_ID') }}"
    costType: ActualCost
    startDate: "{{ now() | date('yyyy-MM-dd') }}"
    endDate: "{{ now() | dateAdd(30, 'DAYS') | date('yyyy-MM-dd') }}"
    aggregation: Cost

  - id: log_forecast
    type: io.kestra.plugin.core.log.Log
    message: "Forecast for the next 30 days: {{ outputs.forecast.totalAmount }} {{ outputs.forecast.unit }}"

pluginDefaults:
  - type: io.kestra.plugin.azure
    values:
      tenantId: "{{ secret('AZURE_TENANT_ID') }}"
      clientId: "{{ secret('AZURE_CLIENT_ID') }}"
      clientSecret: "{{ secret('AZURE_CLIENT_SECRET') }}"
Properties

Aggregation column

Required. Cost column to forecast, for example Cost or PreTaxCost.

Possible Values
ActualCostAmortizedCostUsage

Cost type

Required. ActualCost, AmortizedCost or Usage.

End date

Last day of the forecast period, inclusive like in the Cost Management API, as yyyy-MM-dd.

Scope

Azure scope the costs or budgets belong to, for example /subscriptions/{subscriptionId}, /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}, /providers/Microsoft.Management/managementGroups/{managementGroupId} or /providers/Microsoft.Billing/billingAccounts/{billingAccountId}.

Start date

First day of the forecast period, inclusive, as yyyy-MM-dd.

Azure AD tenant ID (GUID)

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150

Client ID of the Azure AD application

Application (client) ID used for service principal authentication.

Client secret for the Azure AD application

Secret value associated with the client ID; store in a Kestra secret.

Defaultfalse

Include actual cost

Also return the actual cost of the days of the period that are already over.

PEM-encoded certificate content for client authentication

PEM text for certificate-based auth; alternative to clientSecret.

SubTypeobject

Forecast by day

One entry per day, keyed by the column names returned by Azure, e.g. Cost, UsageDate, CostStatus (Forecast or Actual), Currency.

Forecasted total

Sum of the forecasted (non-Actual) entries of the aggregation column. Null when the entries are in more than one currency: use totalAmountByCurrency then.

SubTypenumber

Forecasted total by currency

Sum of the forecasted (non-Actual) entries per value of the Currency column, e.g. totalAmountByCurrency.EUR.

Currency

Currency of the forecast, e.g. USD or EUR. Null when the entries are in more than one currency (possible at EA, MCA or CSP billing scopes).