Scheduled Actions - Create Or Update
Create or update a private scheduled action.
PUT https://management.azure.com/providers/Microsoft.CostManagement/scheduledActions/{name}?api-version=2024-08-01
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
name
|
path | True |
string |
Scheduled action name. |
api-version
|
query | True |
string |
The API version to use for this operation. |
Request Header
Name | Required | Type | Description |
---|---|---|---|
If-Match |
string |
ETag of the Entity. Not required when creating an entity. Optional when updating an entity and can be specified to achieve optimistic concurrency. |
Request Body
Name | Required | Type | Description |
---|---|---|---|
properties.displayName | True |
string |
Scheduled action name. |
properties.notification | True |
Notification properties based on scheduled action kind. |
|
properties.schedule | True |
Schedule of the scheduled action. |
|
properties.status | True |
Status of the scheduled action. |
|
properties.viewId | True |
string |
Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample' |
kind |
Kind of the scheduled action. |
||
properties.fileDestination |
Destination format of the view data. This is optional. |
||
properties.notificationEmail |
string |
Email address of the point of contact that should get the unsubscribe requests and notification emails. |
|
properties.scope |
string |
For private scheduled action(Create or Update), scope will be empty. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
OK. The request has succeeded. |
|
201 Created |
Created. |
|
Other Status Codes |
Error response describing why the operation failed. |
Security
azure_auth
Azure Active Directory OAuth2 Flow.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name | Description |
---|---|
user_impersonation | impersonate your user account |
Examples
CreateOrUpdatePrivateScheduledAction
Sample request
PUT https://management.azure.com/providers/Microsoft.CostManagement/scheduledActions/monthlyCostByResource?api-version=2024-08-01
{
"kind": "Email",
"properties": {
"displayName": "Monthly Cost By Resource",
"notification": {
"to": [
"user@gmail.com",
"team@gmail.com"
],
"subject": "Cost by resource this month"
},
"schedule": {
"frequency": "Monthly",
"weeksOfMonth": [
"First",
"Third"
],
"daysOfWeek": [
"Monday"
],
"hourOfDay": 10,
"startDate": "2020-06-19T22:21:51.1287144Z",
"endDate": "2021-06-19T22:21:51.1287144Z"
},
"status": "Enabled",
"viewId": "/providers/Microsoft.CostManagement/views/swaggerExample"
}
}
Sample response
{
"id": "providers/Microsoft.CostManagement/scheduledActions/monthlyCostByResource",
"name": "monthlyCostByResource",
"type": "Microsoft.CostManagement/ScheduledActions",
"kind": "Email",
"eTag": "\"1d4ff9fe66f1d10\"",
"systemData": {
"createdBy": "testuser",
"createdByType": "User",
"createdAt": "2020-06-18T22:21:51.1287144Z",
"lastModifiedBy": "testuser",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-06-18T22:21:51.1287144Z"
},
"properties": {
"displayName": "Monthly Cost By Resource",
"notification": {
"language": "fr",
"regionalFormat": "fr",
"to": [
"user@gmail.com",
"team@gmail.com"
],
"subject": "Cost by resource this month"
},
"schedule": {
"frequency": "Monthly",
"weeksOfMonth": [
"First",
"Third"
],
"daysOfWeek": [
"Monday"
],
"hourOfDay": 10,
"startDate": "2020-06-19T22:21:51.1287144Z",
"endDate": "2021-06-19T22:21:51.1287144Z"
},
"scope": "",
"status": "Enabled",
"viewId": "/providers/Microsoft.CostManagement/views/swaggerExample"
}
}
{
"id": "providers/Microsoft.CostManagement/scheduledActions/monthlyCostByResource",
"name": "monthlyCostByResource",
"type": "Microsoft.CostManagement/ScheduledActions",
"kind": "Email",
"eTag": "\"1d4ff9fe66f1d10\"",
"systemData": {
"createdBy": "testuser",
"createdByType": "User",
"createdAt": "2020-06-18T22:21:51.1287144Z",
"lastModifiedBy": "testuser",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-06-19T22:21:51.1287144Z"
},
"properties": {
"displayName": "Monthly Cost By Resource",
"notification": {
"language": "fr",
"regionalFormat": "fr",
"to": [
"user@gmail.com",
"team@gmail.com"
],
"subject": "Cost by resource this month"
},
"scope": "",
"status": "Enabled",
"schedule": {
"frequency": "Monthly",
"weeksOfMonth": [
"First",
"Third"
],
"daysOfWeek": [
"Monday"
],
"hourOfDay": 10,
"startDate": "2020-06-19T22:21:51.1287144Z",
"endDate": "2021-06-19T22:21:51.1287144Z"
},
"viewId": "/providers/Microsoft.CostManagement/views/swaggerExample"
}
}
Definitions
Name | Description |
---|---|
created |
The type of identity that created the resource. |
Days |
Days of Week. |
Error |
The details of the error. |
Error |
Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. Some Error responses:
|
File |
Destination of the view data. This is optional. Currently only CSV format is supported. |
File |
Destination of the view data. Currently only CSV format is supported. |
Notification |
The properties of the scheduled action notification. |
Scheduled |
Scheduled action definition. |
Scheduled |
Kind of the scheduled action. |
Scheduled |
Status of the scheduled action. |
Schedule |
Frequency of the schedule. |
Schedule |
The properties of the schedule. |
system |
Metadata pertaining to creation and last modification of the resource. |
Weeks |
Weeks of month. |
createdByType
The type of identity that created the resource.
Name | Type | Description |
---|---|---|
Application |
string |
|
Key |
string |
|
ManagedIdentity |
string |
|
User |
string |
DaysOfWeek
Days of Week.
Name | Type | Description |
---|---|---|
Friday |
string |
|
Monday |
string |
|
Saturday |
string |
|
Sunday |
string |
|
Thursday |
string |
|
Tuesday |
string |
|
Wednesday |
string |
ErrorDetailsWithNestedDetails
The details of the error.
Name | Type | Description |
---|---|---|
code |
string |
Error code. |
details |
The additional details of the error. |
|
message |
string |
Error message indicating why the operation failed. |
ErrorResponseWithNestedDetails
Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message.
Some Error responses:
429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header.
503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header.
Name | Type | Description |
---|---|---|
error |
The details of the error. |
FileDestination
Destination of the view data. This is optional. Currently only CSV format is supported.
Name | Type | Description |
---|---|---|
fileFormats |
Destination of the view data. Currently only CSV format is supported. |
FileFormat
Destination of the view data. Currently only CSV format is supported.
Name | Type | Description |
---|---|---|
Csv |
string |
NotificationProperties
The properties of the scheduled action notification.
Name | Type | Description |
---|---|---|
language |
string |
Locale of the email. |
message |
string |
Optional message to be added in the email. Length is limited to 250 characters. |
regionalFormat |
string |
Regional format used for formatting date/time and currency values in the email. |
subject |
string |
Subject of the email. Length is limited to 70 characters. |
to |
string[] |
Array of email addresses. |
ScheduledAction
Scheduled action definition.
Name | Type | Description |
---|---|---|
eTag |
string |
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. |
id |
string |
Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
kind |
Kind of the scheduled action. |
|
name |
string |
The name of the resource |
properties.displayName |
string |
Scheduled action name. |
properties.fileDestination |
Destination format of the view data. This is optional. |
|
properties.notification |
Notification properties based on scheduled action kind. |
|
properties.notificationEmail |
string |
Email address of the point of contact that should get the unsubscribe requests and notification emails. |
properties.schedule |
Schedule of the scheduled action. |
|
properties.scope |
string |
For private scheduled action(Create or Update), scope will be empty. |
properties.status |
Status of the scheduled action. |
|
properties.viewId |
string |
Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample' |
systemData |
Kind of the scheduled action. |
|
type |
string |
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" |
ScheduledActionKind
Kind of the scheduled action.
Name | Type | Description |
---|---|---|
string |
Cost analysis data will be emailed. |
|
InsightAlert |
string |
Cost anomaly information will be emailed. Available only on subscription scope at daily frequency. If no anomaly is detected on the resource, an email won't be sent. |
ScheduledActionStatus
Status of the scheduled action.
Name | Type | Description |
---|---|---|
Disabled |
string |
Scheduled action is saved but will not be run. |
Enabled |
string |
Scheduled action is saved and will be run. |
Expired |
string |
Scheduled action is expired. |
ScheduleFrequency
Frequency of the schedule.
Name | Type | Description |
---|---|---|
Daily |
string |
Cost analysis data will be emailed every day. |
Monthly |
string |
Cost analysis data will be emailed every month. |
Weekly |
string |
Cost analysis data will be emailed every week. |
ScheduleProperties
The properties of the schedule.
Name | Type | Description |
---|---|---|
dayOfMonth |
integer |
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. |
daysOfWeek |
Day names in english on which cost analysis data will be emailed. This property is applicable when frequency is Weekly or Monthly. |
|
endDate |
string |
The end date and time of the scheduled action (UTC). |
frequency |
Frequency of the schedule. |
|
hourOfDay |
integer |
UTC time at which cost analysis data will be emailed. |
startDate |
string |
The start date and time of the scheduled action (UTC). |
weeksOfMonth |
Weeks in which cost analysis data will be emailed. This property is applicable when frequency is Monthly and used in combination with daysOfWeek. |
systemData
Metadata pertaining to creation and last modification of the resource.
Name | Type | Description |
---|---|---|
createdAt |
string |
The timestamp of resource creation (UTC). |
createdBy |
string |
The identity that created the resource. |
createdByType |
The type of identity that created the resource. |
|
lastModifiedAt |
string |
The timestamp of resource last modification (UTC) |
lastModifiedBy |
string |
The identity that last modified the resource. |
lastModifiedByType |
The type of identity that last modified the resource. |
WeeksOfMonth
Weeks of month.
Name | Type | Description |
---|---|---|
First |
string |
|
Fourth |
string |
|
Last |
string |
|
Second |
string |
|
Third |
string |