1. Packages
  2. Azure Classic
  3. API Docs
  4. costmanagement
  5. AnomalyAlert

We recommend using Azure Native.

Azure v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi

azure.costmanagement.AnomalyAlert

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Manages a Cost Anomaly Alert.

    Note: Anomaly alerts are sent based on the current access of the rule creator at the time that the email is sent. Learn more here.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = new azure.costmanagement.AnomalyAlert("example", {
        name: "alertname",
        displayName: "Alert DisplayName",
        subscriptionId: "/subscriptions/00000000-0000-0000-0000-000000000000",
        emailSubject: "My Test Anomaly Alert",
        emailAddresses: ["example@test.net"],
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.costmanagement.AnomalyAlert("example",
        name="alertname",
        display_name="Alert DisplayName",
        subscription_id="/subscriptions/00000000-0000-0000-0000-000000000000",
        email_subject="My Test Anomaly Alert",
        email_addresses=["example@test.net"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/costmanagement"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := costmanagement.NewAnomalyAlert(ctx, "example", &costmanagement.AnomalyAlertArgs{
    			Name:           pulumi.String("alertname"),
    			DisplayName:    pulumi.String("Alert DisplayName"),
    			SubscriptionId: pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000"),
    			EmailSubject:   pulumi.String("My Test Anomaly Alert"),
    			EmailAddresses: pulumi.StringArray{
    				pulumi.String("example@test.net"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Azure.CostManagement.AnomalyAlert("example", new()
        {
            Name = "alertname",
            DisplayName = "Alert DisplayName",
            SubscriptionId = "/subscriptions/00000000-0000-0000-0000-000000000000",
            EmailSubject = "My Test Anomaly Alert",
            EmailAddresses = new[]
            {
                "example@test.net",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.costmanagement.AnomalyAlert;
    import com.pulumi.azure.costmanagement.AnomalyAlertArgs;
    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 example = new AnomalyAlert("example", AnomalyAlertArgs.builder()
                .name("alertname")
                .displayName("Alert DisplayName")
                .subscriptionId("/subscriptions/00000000-0000-0000-0000-000000000000")
                .emailSubject("My Test Anomaly Alert")
                .emailAddresses("example@test.net")
                .build());
    
        }
    }
    
    resources:
      example:
        type: azure:costmanagement:AnomalyAlert
        properties:
          name: alertname
          displayName: Alert DisplayName
          subscriptionId: /subscriptions/00000000-0000-0000-0000-000000000000
          emailSubject: My Test Anomaly Alert
          emailAddresses:
            - example@test.net
    

    Create AnomalyAlert Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new AnomalyAlert(name: string, args: AnomalyAlertArgs, opts?: CustomResourceOptions);
    @overload
    def AnomalyAlert(resource_name: str,
                     args: AnomalyAlertArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def AnomalyAlert(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     display_name: Optional[str] = None,
                     email_addresses: Optional[Sequence[str]] = None,
                     email_subject: Optional[str] = None,
                     message: Optional[str] = None,
                     name: Optional[str] = None,
                     subscription_id: Optional[str] = None)
    func NewAnomalyAlert(ctx *Context, name string, args AnomalyAlertArgs, opts ...ResourceOption) (*AnomalyAlert, error)
    public AnomalyAlert(string name, AnomalyAlertArgs args, CustomResourceOptions? opts = null)
    public AnomalyAlert(String name, AnomalyAlertArgs args)
    public AnomalyAlert(String name, AnomalyAlertArgs args, CustomResourceOptions options)
    
    type: azure:costmanagement:AnomalyAlert
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args AnomalyAlertArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args AnomalyAlertArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args AnomalyAlertArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AnomalyAlertArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AnomalyAlertArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var anomalyAlertResource = new Azure.CostManagement.AnomalyAlert("anomalyAlertResource", new()
    {
        DisplayName = "string",
        EmailAddresses = new[]
        {
            "string",
        },
        EmailSubject = "string",
        Message = "string",
        Name = "string",
        SubscriptionId = "string",
    });
    
    example, err := costmanagement.NewAnomalyAlert(ctx, "anomalyAlertResource", &costmanagement.AnomalyAlertArgs{
    	DisplayName: pulumi.String("string"),
    	EmailAddresses: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	EmailSubject:   pulumi.String("string"),
    	Message:        pulumi.String("string"),
    	Name:           pulumi.String("string"),
    	SubscriptionId: pulumi.String("string"),
    })
    
    var anomalyAlertResource = new AnomalyAlert("anomalyAlertResource", AnomalyAlertArgs.builder()
        .displayName("string")
        .emailAddresses("string")
        .emailSubject("string")
        .message("string")
        .name("string")
        .subscriptionId("string")
        .build());
    
    anomaly_alert_resource = azure.costmanagement.AnomalyAlert("anomalyAlertResource",
        display_name="string",
        email_addresses=["string"],
        email_subject="string",
        message="string",
        name="string",
        subscription_id="string")
    
    const anomalyAlertResource = new azure.costmanagement.AnomalyAlert("anomalyAlertResource", {
        displayName: "string",
        emailAddresses: ["string"],
        emailSubject: "string",
        message: "string",
        name: "string",
        subscriptionId: "string",
    });
    
    type: azure:costmanagement:AnomalyAlert
    properties:
        displayName: string
        emailAddresses:
            - string
        emailSubject: string
        message: string
        name: string
        subscriptionId: string
    

    AnomalyAlert Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The AnomalyAlert resource accepts the following input properties:

    DisplayName string
    The display name which should be used for this Cost Anomaly Alert.
    EmailAddresses List<string>
    Specifies a list of email addresses which the Anomaly Alerts are send to.
    EmailSubject string
    The email subject of the Cost Anomaly Alerts. Maximum length of the subject is 70.
    Message string
    The message of the Cost Anomaly Alert. Maximum length of the message is 250.
    Name string
    The name which should be used for this Cost Anomaly Alert. Changing this forces a new resource to be created. The name can contain only lowercase letters, numbers and hyphens.
    SubscriptionId string
    The ID of the Subscription this Cost Anomaly Alert is scoped to. Changing this forces a new resource to be created. When not supplied this defaults to the subscription configured in the provider.
    DisplayName string
    The display name which should be used for this Cost Anomaly Alert.
    EmailAddresses []string
    Specifies a list of email addresses which the Anomaly Alerts are send to.
    EmailSubject string
    The email subject of the Cost Anomaly Alerts. Maximum length of the subject is 70.
    Message string
    The message of the Cost Anomaly Alert. Maximum length of the message is 250.
    Name string
    The name which should be used for this Cost Anomaly Alert. Changing this forces a new resource to be created. The name can contain only lowercase letters, numbers and hyphens.
    SubscriptionId string
    The ID of the Subscription this Cost Anomaly Alert is scoped to. Changing this forces a new resource to be created. When not supplied this defaults to the subscription configured in the provider.
    displayName String
    The display name which should be used for this Cost Anomaly Alert.
    emailAddresses List<String>
    Specifies a list of email addresses which the Anomaly Alerts are send to.
    emailSubject String
    The email subject of the Cost Anomaly Alerts. Maximum length of the subject is 70.
    message String
    The message of the Cost Anomaly Alert. Maximum length of the message is 250.
    name String
    The name which should be used for this Cost Anomaly Alert. Changing this forces a new resource to be created. The name can contain only lowercase letters, numbers and hyphens.
    subscriptionId String
    The ID of the Subscription this Cost Anomaly Alert is scoped to. Changing this forces a new resource to be created. When not supplied this defaults to the subscription configured in the provider.
    displayName string
    The display name which should be used for this Cost Anomaly Alert.
    emailAddresses string[]
    Specifies a list of email addresses which the Anomaly Alerts are send to.
    emailSubject string
    The email subject of the Cost Anomaly Alerts. Maximum length of the subject is 70.
    message string
    The message of the Cost Anomaly Alert. Maximum length of the message is 250.
    name string
    The name which should be used for this Cost Anomaly Alert. Changing this forces a new resource to be created. The name can contain only lowercase letters, numbers and hyphens.
    subscriptionId string
    The ID of the Subscription this Cost Anomaly Alert is scoped to. Changing this forces a new resource to be created. When not supplied this defaults to the subscription configured in the provider.
    display_name str
    The display name which should be used for this Cost Anomaly Alert.
    email_addresses Sequence[str]
    Specifies a list of email addresses which the Anomaly Alerts are send to.
    email_subject str
    The email subject of the Cost Anomaly Alerts. Maximum length of the subject is 70.
    message str
    The message of the Cost Anomaly Alert. Maximum length of the message is 250.
    name str
    The name which should be used for this Cost Anomaly Alert. Changing this forces a new resource to be created. The name can contain only lowercase letters, numbers and hyphens.
    subscription_id str
    The ID of the Subscription this Cost Anomaly Alert is scoped to. Changing this forces a new resource to be created. When not supplied this defaults to the subscription configured in the provider.
    displayName String
    The display name which should be used for this Cost Anomaly Alert.
    emailAddresses List<String>
    Specifies a list of email addresses which the Anomaly Alerts are send to.
    emailSubject String
    The email subject of the Cost Anomaly Alerts. Maximum length of the subject is 70.
    message String
    The message of the Cost Anomaly Alert. Maximum length of the message is 250.
    name String
    The name which should be used for this Cost Anomaly Alert. Changing this forces a new resource to be created. The name can contain only lowercase letters, numbers and hyphens.
    subscriptionId String
    The ID of the Subscription this Cost Anomaly Alert is scoped to. Changing this forces a new resource to be created. When not supplied this defaults to the subscription configured in the provider.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the AnomalyAlert resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing AnomalyAlert Resource

    Get an existing AnomalyAlert resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: AnomalyAlertState, opts?: CustomResourceOptions): AnomalyAlert
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            display_name: Optional[str] = None,
            email_addresses: Optional[Sequence[str]] = None,
            email_subject: Optional[str] = None,
            message: Optional[str] = None,
            name: Optional[str] = None,
            subscription_id: Optional[str] = None) -> AnomalyAlert
    func GetAnomalyAlert(ctx *Context, name string, id IDInput, state *AnomalyAlertState, opts ...ResourceOption) (*AnomalyAlert, error)
    public static AnomalyAlert Get(string name, Input<string> id, AnomalyAlertState? state, CustomResourceOptions? opts = null)
    public static AnomalyAlert get(String name, Output<String> id, AnomalyAlertState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    DisplayName string
    The display name which should be used for this Cost Anomaly Alert.
    EmailAddresses List<string>
    Specifies a list of email addresses which the Anomaly Alerts are send to.
    EmailSubject string
    The email subject of the Cost Anomaly Alerts. Maximum length of the subject is 70.
    Message string
    The message of the Cost Anomaly Alert. Maximum length of the message is 250.
    Name string
    The name which should be used for this Cost Anomaly Alert. Changing this forces a new resource to be created. The name can contain only lowercase letters, numbers and hyphens.
    SubscriptionId string
    The ID of the Subscription this Cost Anomaly Alert is scoped to. Changing this forces a new resource to be created. When not supplied this defaults to the subscription configured in the provider.
    DisplayName string
    The display name which should be used for this Cost Anomaly Alert.
    EmailAddresses []string
    Specifies a list of email addresses which the Anomaly Alerts are send to.
    EmailSubject string
    The email subject of the Cost Anomaly Alerts. Maximum length of the subject is 70.
    Message string
    The message of the Cost Anomaly Alert. Maximum length of the message is 250.
    Name string
    The name which should be used for this Cost Anomaly Alert. Changing this forces a new resource to be created. The name can contain only lowercase letters, numbers and hyphens.
    SubscriptionId string
    The ID of the Subscription this Cost Anomaly Alert is scoped to. Changing this forces a new resource to be created. When not supplied this defaults to the subscription configured in the provider.
    displayName String
    The display name which should be used for this Cost Anomaly Alert.
    emailAddresses List<String>
    Specifies a list of email addresses which the Anomaly Alerts are send to.
    emailSubject String
    The email subject of the Cost Anomaly Alerts. Maximum length of the subject is 70.
    message String
    The message of the Cost Anomaly Alert. Maximum length of the message is 250.
    name String
    The name which should be used for this Cost Anomaly Alert. Changing this forces a new resource to be created. The name can contain only lowercase letters, numbers and hyphens.
    subscriptionId String
    The ID of the Subscription this Cost Anomaly Alert is scoped to. Changing this forces a new resource to be created. When not supplied this defaults to the subscription configured in the provider.
    displayName string
    The display name which should be used for this Cost Anomaly Alert.
    emailAddresses string[]
    Specifies a list of email addresses which the Anomaly Alerts are send to.
    emailSubject string
    The email subject of the Cost Anomaly Alerts. Maximum length of the subject is 70.
    message string
    The message of the Cost Anomaly Alert. Maximum length of the message is 250.
    name string
    The name which should be used for this Cost Anomaly Alert. Changing this forces a new resource to be created. The name can contain only lowercase letters, numbers and hyphens.
    subscriptionId string
    The ID of the Subscription this Cost Anomaly Alert is scoped to. Changing this forces a new resource to be created. When not supplied this defaults to the subscription configured in the provider.
    display_name str
    The display name which should be used for this Cost Anomaly Alert.
    email_addresses Sequence[str]
    Specifies a list of email addresses which the Anomaly Alerts are send to.
    email_subject str
    The email subject of the Cost Anomaly Alerts. Maximum length of the subject is 70.
    message str
    The message of the Cost Anomaly Alert. Maximum length of the message is 250.
    name str
    The name which should be used for this Cost Anomaly Alert. Changing this forces a new resource to be created. The name can contain only lowercase letters, numbers and hyphens.
    subscription_id str
    The ID of the Subscription this Cost Anomaly Alert is scoped to. Changing this forces a new resource to be created. When not supplied this defaults to the subscription configured in the provider.
    displayName String
    The display name which should be used for this Cost Anomaly Alert.
    emailAddresses List<String>
    Specifies a list of email addresses which the Anomaly Alerts are send to.
    emailSubject String
    The email subject of the Cost Anomaly Alerts. Maximum length of the subject is 70.
    message String
    The message of the Cost Anomaly Alert. Maximum length of the message is 250.
    name String
    The name which should be used for this Cost Anomaly Alert. Changing this forces a new resource to be created. The name can contain only lowercase letters, numbers and hyphens.
    subscriptionId String
    The ID of the Subscription this Cost Anomaly Alert is scoped to. Changing this forces a new resource to be created. When not supplied this defaults to the subscription configured in the provider.

    Import

    Cost Anomaly Alerts can be imported using the resource id, e.g.

    $ pulumi import azure:costmanagement/anomalyAlert:AnomalyAlert example /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CostManagement/scheduledActions/dailyanomalybyresourcegroup
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi