Scheduled Action By Scope Args
Scheduled action definition. Uses Azure REST API version 2024-08-01. In version 2.x of the Azure Native provider, it used API version 2023-03-01. Other available API versions: 2022-04-01-preview, 2022-06-01-preview, 2022-10-01, 2023-03-01, 2023-04-01-preview, 2023-07-01-preview, 2023-08-01, 2023-09-01, 2023-11-01, 2024-10-01-preview. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native costmanagement [ApiVersion]
. See the ../../../version-guide/#accessing-any-api-version-via-local-packages for details.
Example Usage
CreateOrUpdateInsightAlertScheduledActionByScope
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var scheduledActionByScope = new AzureNative.CostManagement.ScheduledActionByScope("scheduledActionByScope", new()
{
DisplayName = "Daily anomaly by resource",
Kind = AzureNative.CostManagement.ScheduledActionKind.InsightAlert,
Name = "dailyAnomalyByResource",
Notification = new AzureNative.CostManagement.Inputs.NotificationPropertiesArgs
{
Subject = "Cost anomaly detected in the resource",
To = new[]
{
"user@gmail.com",
"team@gmail.com",
},
},
Schedule = new AzureNative.CostManagement.Inputs.SchedulePropertiesArgs
{
EndDate = "2021-06-19T22:21:51.1287144Z",
Frequency = AzureNative.CostManagement.ScheduleFrequency.Daily,
StartDate = "2020-06-19T22:21:51.1287144Z",
},
Scope = "subscriptions/00000000-0000-0000-0000-000000000000",
Status = AzureNative.CostManagement.ScheduledActionStatus.Enabled,
ViewId = "/providers/Microsoft.CostManagement/views/swaggerExample",
});
});
package main
import (
costmanagement "github.com/pulumi/pulumi-azure-native-sdk/costmanagement/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := costmanagement.NewScheduledActionByScope(ctx, "scheduledActionByScope", &costmanagement.ScheduledActionByScopeArgs{
DisplayName: pulumi.String("Daily anomaly by resource"),
Kind: pulumi.String(costmanagement.ScheduledActionKindInsightAlert),
Name: pulumi.String("dailyAnomalyByResource"),
Notification: &costmanagement.NotificationPropertiesArgs{
Subject: pulumi.String("Cost anomaly detected in the resource"),
To: pulumi.StringArray{
pulumi.String("user@gmail.com"),
pulumi.String("team@gmail.com"),
},
},
Schedule: &costmanagement.SchedulePropertiesArgs{
EndDate: pulumi.String("2021-06-19T22:21:51.1287144Z"),
Frequency: pulumi.String(costmanagement.ScheduleFrequencyDaily),
StartDate: pulumi.String("2020-06-19T22:21:51.1287144Z"),
},
Scope: pulumi.String("subscriptions/00000000-0000-0000-0000-000000000000"),
Status: pulumi.String(costmanagement.ScheduledActionStatusEnabled),
ViewId: pulumi.String("/providers/Microsoft.CostManagement/views/swaggerExample"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.costmanagement.ScheduledActionByScope;
import com.pulumi.azurenative.costmanagement.ScheduledActionByScopeArgs;
import com.pulumi.azurenative.costmanagement.inputs.NotificationPropertiesArgs;
import com.pulumi.azurenative.costmanagement.inputs.SchedulePropertiesArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var scheduledActionByScope = new ScheduledActionByScope("scheduledActionByScope", ScheduledActionByScopeArgs.builder()
.displayName("Daily anomaly by resource")
.kind("InsightAlert")
.name("dailyAnomalyByResource")
.notification(NotificationPropertiesArgs.builder()
.subject("Cost anomaly detected in the resource")
.to(
"user@gmail.com",
"team@gmail.com")
.build())
.schedule(SchedulePropertiesArgs.builder()
.endDate("2021-06-19T22:21:51.1287144Z")
.frequency("Daily")
.startDate("2020-06-19T22:21:51.1287144Z")
.build())
.scope("subscriptions/00000000-0000-0000-0000-000000000000")
.status("Enabled")
.viewId("/providers/Microsoft.CostManagement/views/swaggerExample")
.build());
}
}
CreateOrUpdateScheduledActionByScope
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var scheduledActionByScope = new AzureNative.CostManagement.ScheduledActionByScope("scheduledActionByScope", new()
{
DisplayName = "Monthly Cost By Resource",
FileDestination = new AzureNative.CostManagement.Inputs.FileDestinationArgs
{
FileFormats = new[]
{
AzureNative.CostManagement.FileFormat.Csv,
},
},
Kind = AzureNative.CostManagement.ScheduledActionKind.Email,
Name = "monthlyCostByResource",
Notification = new AzureNative.CostManagement.Inputs.NotificationPropertiesArgs
{
Subject = "Cost by resource this month",
To = new[]
{
"user@gmail.com",
"team@gmail.com",
},
},
Schedule = new AzureNative.CostManagement.Inputs.SchedulePropertiesArgs
{
DaysOfWeek = new[]
{
AzureNative.CostManagement.DaysOfWeek.Monday,
},
EndDate = "2021-06-19T22:21:51.1287144Z",
Frequency = AzureNative.CostManagement.ScheduleFrequency.Monthly,
HourOfDay = 10,
StartDate = "2020-06-19T22:21:51.1287144Z",
WeeksOfMonth = new[]
{
AzureNative.CostManagement.WeeksOfMonth.First,
AzureNative.CostManagement.WeeksOfMonth.Third,
},
},
Scope = "subscriptions/00000000-0000-0000-0000-000000000000",
Status = AzureNative.CostManagement.ScheduledActionStatus.Enabled,
ViewId = "/providers/Microsoft.CostManagement/views/swaggerExample",
});
});
package main
import (
costmanagement "github.com/pulumi/pulumi-azure-native-sdk/costmanagement/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := costmanagement.NewScheduledActionByScope(ctx, "scheduledActionByScope", &costmanagement.ScheduledActionByScopeArgs{
DisplayName: pulumi.String("Monthly Cost By Resource"),
FileDestination: &costmanagement.FileDestinationArgs{
FileFormats: pulumi.StringArray{
pulumi.String(costmanagement.FileFormatCsv),
},
},
Kind: pulumi.String(costmanagement.ScheduledActionKindEmail),
Name: pulumi.String("monthlyCostByResource"),
Notification: &costmanagement.NotificationPropertiesArgs{
Subject: pulumi.String("Cost by resource this month"),
To: pulumi.StringArray{
pulumi.String("user@gmail.com"),
pulumi.String("team@gmail.com"),
},
},
Schedule: &costmanagement.SchedulePropertiesArgs{
DaysOfWeek: pulumi.StringArray{
pulumi.String(costmanagement.DaysOfWeekMonday),
},
EndDate: pulumi.String("2021-06-19T22:21:51.1287144Z"),
Frequency: pulumi.String(costmanagement.ScheduleFrequencyMonthly),
HourOfDay: pulumi.Int(10),
StartDate: pulumi.String("2020-06-19T22:21:51.1287144Z"),
WeeksOfMonth: pulumi.StringArray{
pulumi.String(costmanagement.WeeksOfMonthFirst),
pulumi.String(costmanagement.WeeksOfMonthThird),
},
},
Scope: pulumi.String("subscriptions/00000000-0000-0000-0000-000000000000"),
Status: pulumi.String(costmanagement.ScheduledActionStatusEnabled),
ViewId: pulumi.String("/providers/Microsoft.CostManagement/views/swaggerExample"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.costmanagement.ScheduledActionByScope;
import com.pulumi.azurenative.costmanagement.ScheduledActionByScopeArgs;
import com.pulumi.azurenative.costmanagement.inputs.FileDestinationArgs;
import com.pulumi.azurenative.costmanagement.inputs.NotificationPropertiesArgs;
import com.pulumi.azurenative.costmanagement.inputs.SchedulePropertiesArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var scheduledActionByScope = new ScheduledActionByScope("scheduledActionByScope", ScheduledActionByScopeArgs.builder()
.displayName("Monthly Cost By Resource")
.fileDestination(FileDestinationArgs.builder()
.fileFormats("Csv")
.build())
.kind("Email")
.name("monthlyCostByResource")
.notification(NotificationPropertiesArgs.builder()
.subject("Cost by resource this month")
.to(
"user@gmail.com",
"team@gmail.com")
.build())
.schedule(SchedulePropertiesArgs.builder()
.daysOfWeek("Monday")
.endDate("2021-06-19T22:21:51.1287144Z")
.frequency("Monthly")
.hourOfDay(10)
.startDate("2020-06-19T22:21:51.1287144Z")
.weeksOfMonth(
"First",
"Third")
.build())
.scope("subscriptions/00000000-0000-0000-0000-000000000000")
.status("Enabled")
.viewId("/providers/Microsoft.CostManagement/views/swaggerExample")
.build());
}
}
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:costmanagement:ScheduledActionByScope monthlyCostByResource /{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}
Constructors
Properties
Scheduled action name.
Destination format of the view data. This is optional.
Kind of the scheduled action.
Notification properties based on scheduled action kind.
Email address of the point of contact that should get the unsubscribe requests and notification emails.
Schedule of the scheduled action.
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.
Status of the scheduled action.