Microsoft.CostManagement scheduledActions

Bicep resource definition

The scheduledActions resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.CostManagement/scheduledActions resource, add the following Bicep to your template.

resource symbolicname 'Microsoft.CostManagement/scheduledActions@2025-03-01' = {
  scope: resourceSymbolicName or scope
  eTag: 'string'
  kind: 'string'
  name: 'string'
  properties: {
    displayName: 'string'
    fileDestination: {
      fileFormats: [
        'string'
      ]
    }
    notification: {
      language: 'string'
      message: 'string'
      regionalFormat: 'string'
      subject: 'string'
      to: [
        'string'
      ]
    }
    notificationEmail: 'string'
    schedule: {
      dayOfMonth: int
      daysOfWeek: [
        'string'
      ]
      endDate: 'string'
      frequency: 'string'
      hourOfDay: int
      startDate: 'string'
      weeksOfMonth: [
        'string'
      ]
    }
    scope: 'string'
    status: 'string'
    viewId: 'string'
  }
}

Property Values

Microsoft.CostManagement/scheduledActions

Name Description Value
eTag Resource Etag. For update calls, eTag is optional and can be specified to achieve optimistic concurrency. Fetch the resource's eTag by doing a 'GET' call first and then including the latest eTag as part of the request body or 'If-Match' header while performing the update. For create calls, eTag is not required. string
kind Kind of the scheduled action. 'Email'
'InsightAlert'
name The resource name string (required)
properties The properties of the scheduled action. ScheduledActionProperties
scope Use when creating a resource at a scope that is different than the deployment scope. Set this property to the symbolic name of a resource to apply the extension resource.

FileDestination

Name Description Value
fileFormats Destination of the view data. Currently only CSV format is supported. String array containing any of:
'Csv'

NotificationProperties

Name Description Value
language Locale of the email. string
message Optional message to be added in the email. Length is limited to 250 characters. string
regionalFormat Regional format used for formatting date/time and currency values in the email. string
subject Subject of the email. Length is limited to 70 characters. string (required)
to Array of email addresses. string[] (required)

ScheduledActionProperties

Name Description Value
displayName Scheduled action name. string (required)
fileDestination Destination format of the view data. This is optional. FileDestination
notification Notification properties based on scheduled action kind. NotificationProperties (required)
notificationEmail Email address of the point of contact that should get the unsubscribe requests and notification emails. string
schedule Schedule of the scheduled action. ScheduleProperties (required)
scope For private scheduled action(Create or Update), scope will be empty.
For shared scheduled action(Create or Update By Scope), Cost Management scope can be 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope.
string
status Status of the scheduled action. 'Disabled'
'Enabled'
'Expired' (required)
viewId Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample' string (required)

ScheduleProperties

Name Description Value
dayOfMonth UTC day on which cost analysis data will be emailed. Must be between 1 and 31. This property is applicable when frequency is Monthly and overrides weeksOfMonth or daysOfWeek. int
daysOfWeek Day names in english on which cost analysis data will be emailed. This property is applicable when frequency is Weekly or Monthly. String array containing any of:
'Friday'
'Monday'
'Saturday'
'Sunday'
'Thursday'
'Tuesday'
'Wednesday'
endDate The end date and time of the scheduled action (UTC). string (required)
frequency Frequency of the schedule. 'Daily'
'Monthly'
'Weekly' (required)
hourOfDay UTC time at which cost analysis data will be emailed. int
startDate The start date and time of the scheduled action (UTC). string (required)
weeksOfMonth Weeks in which cost analysis data will be emailed. This property is applicable when frequency is Monthly and used in combination with daysOfWeek. String array containing any of:
'First'
'Fourth'
'Last'
'Second'
'Third'

Usage Examples

Bicep Samples

A basic example of deploying Azure Cost Management Scheduled Action.

targetScope = 'subscription'

param location string = 'eastus'
param resourceName string = 'acctest0001'

resource scheduledAction 'Microsoft.CostManagement/scheduledActions@2022-10-01' = {
  name: resourceName
  scope: subscription()
  kind: 'Email'
  properties: {
    displayName: 'CostByServiceViewerz3k'
    fileDestination: {
      fileFormats: []
    }
    notification: {
      message: ''
      subject: 'Cost Management Report for Terraform Testing on Azure with TTL = 2 Day'
      to: [
        'test@test.com'
        'hashicorp@test.com'
      ]
    }
    notificationEmail: 'test@test.com'
    schedule: {
      dayOfMonth: 0
      endDate: '2023-07-02T00:00:00Z'
      frequency: 'Daily'
      hourOfDay: 0
      startDate: '2023-07-01T00:00:00Z'
    }
    status: 'Enabled'
    viewId: resourceId('Microsoft.CostManagement/views', 'ms:CostByService')
  }
}

ARM template resource definition

The scheduledActions resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.CostManagement/scheduledActions resource, add the following JSON to your template.

{
  "type": "Microsoft.CostManagement/scheduledActions",
  "apiVersion": "2025-03-01",
  "name": "string",
  "eTag": "string",
  "kind": "string",
  "properties": {
    "displayName": "string",
    "fileDestination": {
      "fileFormats": [ "string" ]
    },
    "notification": {
      "language": "string",
      "message": "string",
      "regionalFormat": "string",
      "subject": "string",
      "to": [ "string" ]
    },
    "notificationEmail": "string",
    "schedule": {
      "dayOfMonth": "int",
      "daysOfWeek": [ "string" ],
      "endDate": "string",
      "frequency": "string",
      "hourOfDay": "int",
      "startDate": "string",
      "weeksOfMonth": [ "string" ]
    },
    "scope": "string",
    "status": "string",
    "viewId": "string"
  }
}

Property Values

Microsoft.CostManagement/scheduledActions

Name Description Value
apiVersion The api version '2025-03-01'
eTag Resource Etag. For update calls, eTag is optional and can be specified to achieve optimistic concurrency. Fetch the resource's eTag by doing a 'GET' call first and then including the latest eTag as part of the request body or 'If-Match' header while performing the update. For create calls, eTag is not required. string
kind Kind of the scheduled action. 'Email'
'InsightAlert'
name The resource name string (required)
properties The properties of the scheduled action. ScheduledActionProperties
type The resource type 'Microsoft.CostManagement/scheduledActions'

FileDestination

Name Description Value
fileFormats Destination of the view data. Currently only CSV format is supported. String array containing any of:
'Csv'

NotificationProperties

Name Description Value
language Locale of the email. string
message Optional message to be added in the email. Length is limited to 250 characters. string
regionalFormat Regional format used for formatting date/time and currency values in the email. string
subject Subject of the email. Length is limited to 70 characters. string (required)
to Array of email addresses. string[] (required)

ScheduledActionProperties

Name Description Value
displayName Scheduled action name. string (required)
fileDestination Destination format of the view data. This is optional. FileDestination
notification Notification properties based on scheduled action kind. NotificationProperties (required)
notificationEmail Email address of the point of contact that should get the unsubscribe requests and notification emails. string
schedule Schedule of the scheduled action. ScheduleProperties (required)
scope For private scheduled action(Create or Update), scope will be empty.
For shared scheduled action(Create or Update By Scope), Cost Management scope can be 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope.
string
status Status of the scheduled action. 'Disabled'
'Enabled'
'Expired' (required)
viewId Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample' string (required)

ScheduleProperties

Name Description Value
dayOfMonth UTC day on which cost analysis data will be emailed. Must be between 1 and 31. This property is applicable when frequency is Monthly and overrides weeksOfMonth or daysOfWeek. int
daysOfWeek Day names in english on which cost analysis data will be emailed. This property is applicable when frequency is Weekly or Monthly. String array containing any of:
'Friday'
'Monday'
'Saturday'
'Sunday'
'Thursday'
'Tuesday'
'Wednesday'
endDate The end date and time of the scheduled action (UTC). string (required)
frequency Frequency of the schedule. 'Daily'
'Monthly'
'Weekly' (required)
hourOfDay UTC time at which cost analysis data will be emailed. int
startDate The start date and time of the scheduled action (UTC). string (required)
weeksOfMonth Weeks in which cost analysis data will be emailed. This property is applicable when frequency is Monthly and used in combination with daysOfWeek. String array containing any of:
'First'
'Fourth'
'Last'
'Second'
'Third'

Usage Examples

Terraform (AzAPI provider) resource definition

The scheduledActions resource type can be deployed with operations that target:

  • Tenant* Management groups* Subscription* Resource groups

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.CostManagement/scheduledActions resource, add the following Terraform to your template.

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.CostManagement/scheduledActions@2025-03-01"
  name = "string"
  parent_id = "string"
  body = {
    eTag = "string"
    kind = "string"
    properties = {
      displayName = "string"
      fileDestination = {
        fileFormats = [
          "string"
        ]
      }
      notification = {
        language = "string"
        message = "string"
        regionalFormat = "string"
        subject = "string"
        to = [
          "string"
        ]
      }
      notificationEmail = "string"
      schedule = {
        dayOfMonth = int
        daysOfWeek = [
          "string"
        ]
        endDate = "string"
        frequency = "string"
        hourOfDay = int
        startDate = "string"
        weeksOfMonth = [
          "string"
        ]
      }
      scope = "string"
      status = "string"
      viewId = "string"
    }
  }
}

Property Values

Microsoft.CostManagement/scheduledActions

Name Description Value
eTag Resource Etag. For update calls, eTag is optional and can be specified to achieve optimistic concurrency. Fetch the resource's eTag by doing a 'GET' call first and then including the latest eTag as part of the request body or 'If-Match' header while performing the update. For create calls, eTag is not required. string
kind Kind of the scheduled action. 'Email'
'InsightAlert'
name The resource name string (required)
parent_id The ID of the resource to apply this extension resource to. string (required)
properties The properties of the scheduled action. ScheduledActionProperties
type The resource type "Microsoft.CostManagement/scheduledActions@2025-03-01"

FileDestination

Name Description Value
fileFormats Destination of the view data. Currently only CSV format is supported. String array containing any of:
'Csv'

NotificationProperties

Name Description Value
language Locale of the email. string
message Optional message to be added in the email. Length is limited to 250 characters. string
regionalFormat Regional format used for formatting date/time and currency values in the email. string
subject Subject of the email. Length is limited to 70 characters. string (required)
to Array of email addresses. string[] (required)

ScheduledActionProperties

Name Description Value
displayName Scheduled action name. string (required)
fileDestination Destination format of the view data. This is optional. FileDestination
notification Notification properties based on scheduled action kind. NotificationProperties (required)
notificationEmail Email address of the point of contact that should get the unsubscribe requests and notification emails. string
schedule Schedule of the scheduled action. ScheduleProperties (required)
scope For private scheduled action(Create or Update), scope will be empty.
For shared scheduled action(Create or Update By Scope), Cost Management scope can be 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope.
string
status Status of the scheduled action. 'Disabled'
'Enabled'
'Expired' (required)
viewId Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample' string (required)

ScheduleProperties

Name Description Value
dayOfMonth UTC day on which cost analysis data will be emailed. Must be between 1 and 31. This property is applicable when frequency is Monthly and overrides weeksOfMonth or daysOfWeek. int
daysOfWeek Day names in english on which cost analysis data will be emailed. This property is applicable when frequency is Weekly or Monthly. String array containing any of:
'Friday'
'Monday'
'Saturday'
'Sunday'
'Thursday'
'Tuesday'
'Wednesday'
endDate The end date and time of the scheduled action (UTC). string (required)
frequency Frequency of the schedule. 'Daily'
'Monthly'
'Weekly' (required)
hourOfDay UTC time at which cost analysis data will be emailed. int
startDate The start date and time of the scheduled action (UTC). string (required)
weeksOfMonth Weeks in which cost analysis data will be emailed. This property is applicable when frequency is Monthly and used in combination with daysOfWeek. String array containing any of:
'First'
'Fourth'
'Last'
'Second'
'Third'

Usage Examples

Terraform Samples

A basic example of deploying Azure Cost Management Scheduled Action.

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
    azurerm = {
      source = "hashicorp/azurerm"
    }
  }
}

provider "azurerm" {
  features {
  }
}

provider "azapi" {
  skip_provider_registration = false
}

variable "resource_name" {
  type    = string
  default = "acctest0001"
}

variable "location" {
  type    = string
  default = "eastus"
}

data "azurerm_client_config" "current" {
}

data "azapi_resource" "subscription" {
  type                   = "Microsoft.Resources/subscriptions@2021-01-01"
  resource_id            = "/subscriptions/${data.azurerm_client_config.current.subscription_id}"
  response_export_values = ["*"]
}

data "azapi_resource_id" "view" {
  type      = "Microsoft.CostManagement/views@2023-04-01-preview"
  parent_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}"
  name      = "ms:CostByService"
}

resource "azapi_resource" "scheduledAction" {
  type      = "Microsoft.CostManagement/scheduledActions@2022-10-01"
  parent_id = data.azapi_resource.subscription.id
  name      = var.resource_name
  body = {
    kind = "Email"
    properties = {
      displayName = "CostByServiceViewerz3k"
      fileDestination = {
        fileFormats = [
        ]
      }
      notification = {
        message = ""
        subject = "Cost Management Report for Terraform Testing on Azure with TTL = 2 Day"
        to = [
          "test@test.com",
          "hashicorp@test.com",
        ]
      }
      notificationEmail = "test@test.com"
      schedule = {
        dayOfMonth   = 0
        daysOfWeek   = null
        endDate      = "2023-07-02T00:00:00Z"
        frequency    = "Daily"
        hourOfDay    = 0
        startDate    = "2023-07-01T00:00:00Z"
        weeksOfMonth = null
      }
      status = "Enabled"
      viewId = data.azapi_resource_id.view.id
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

A basic example of deploying Azure Cost Management Scheduled Action.

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
    azurerm = {
      source = "hashicorp/azurerm"
    }
  }
}

provider "azurerm" {
  features {
  }
}

provider "azapi" {
  skip_provider_registration = false
}

variable "resource_name" {
  type    = string
  default = "acctest0001"
}

variable "location" {
  type    = string
  default = "eastus"
}

data "azurerm_client_config" "current" {
}

data "azapi_resource" "subscription" {
  type                   = "Microsoft.Resources/subscriptions@2021-01-01"
  resource_id            = "/subscriptions/${data.azurerm_client_config.current.subscription_id}"
  response_export_values = ["*"]
}

data "azapi_resource_id" "view" {
  type      = "Microsoft.CostManagement/views@2023-04-01-preview"
  parent_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}"
  name      = "ms:CostByService"
}

resource "azapi_resource" "scheduledAction" {
  type      = "Microsoft.CostManagement/scheduledActions@2022-10-01"
  parent_id = data.azapi_resource.subscription.id
  name      = var.resource_name
  body = {
    kind = "Email"
    properties = {
      displayName = "CostByServiceViewerz3k"
      fileDestination = {
        fileFormats = [
        ]
      }
      notification = {
        message = ""
        subject = "Cost Management Report for Terraform Testing on Azure with TTL = 2 Day"
        to = [
          "test@test.com",
          "hashicorp@test.com",
        ]
      }
      notificationEmail = "test@test.com"
      schedule = {
        dayOfMonth   = 0
        daysOfWeek   = null
        endDate      = "2023-07-02T00:00:00Z"
        frequency    = "Daily"
        hourOfDay    = 0
        startDate    = "2023-07-01T00:00:00Z"
        weeksOfMonth = null
      }
      status = "Enabled"
      viewId = data.azapi_resource_id.view.id
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}