1. Packages
  2. Azure Classic
  3. API Docs
  4. advisor
  5. Suppression

We recommend using Azure Native.

Azure v6.21.0 published on Friday, Mar 7, 2025 by Pulumi

azure.advisor.Suppression

Explore with Pulumi AI

Specifies a suppression for an Azure Advisor recommendation.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const current = azure.core.getClientConfig({});
const example = azure.advisor.getRecommendations({});
const exampleSuppression = new azure.advisor.Suppression("example", {
    name: "HardcodedSuppressionName",
    recommendationId: test.recommendations[0].recommendationName,
    resourceId: current.then(current => `/subscriptions/${current.subscriptionId}`),
    ttl: "01:00:00:00",
});
Copy
import pulumi
import pulumi_azure as azure

current = azure.core.get_client_config()
example = azure.advisor.get_recommendations()
example_suppression = azure.advisor.Suppression("example",
    name="HardcodedSuppressionName",
    recommendation_id=test["recommendations"][0]["recommendationName"],
    resource_id=f"/subscriptions/{current.subscription_id}",
    ttl="01:00:00:00")
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/advisor"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := core.GetClientConfig(ctx, map[string]interface{}{}, nil)
		if err != nil {
			return err
		}
		_, err = advisor.GetRecommendations(ctx, &advisor.GetRecommendationsArgs{}, nil)
		if err != nil {
			return err
		}
		_, err = advisor.NewSuppression(ctx, "example", &advisor.SuppressionArgs{
			Name:             pulumi.String("HardcodedSuppressionName"),
			RecommendationId: pulumi.Any(test.Recommendations[0].RecommendationName),
			ResourceId:       pulumi.Sprintf("/subscriptions/%v", current.SubscriptionId),
			Ttl:              pulumi.String("01:00:00:00"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var current = Azure.Core.GetClientConfig.Invoke();

    var example = Azure.Advisor.GetRecommendations.Invoke();

    var exampleSuppression = new Azure.Advisor.Suppression("example", new()
    {
        Name = "HardcodedSuppressionName",
        RecommendationId = test.Recommendations[0].RecommendationName,
        ResourceId = $"/subscriptions/{current.Apply(getClientConfigResult => getClientConfigResult.SubscriptionId)}",
        Ttl = "01:00:00:00",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.CoreFunctions;
import com.pulumi.azure.advisor.AdvisorFunctions;
import com.pulumi.azure.advisor.inputs.GetRecommendationsArgs;
import com.pulumi.azure.advisor.Suppression;
import com.pulumi.azure.advisor.SuppressionArgs;
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) {
        final var current = CoreFunctions.getClientConfig();

        final var example = AdvisorFunctions.getRecommendations();

        var exampleSuppression = new Suppression("exampleSuppression", SuppressionArgs.builder()
            .name("HardcodedSuppressionName")
            .recommendationId(test.recommendations()[0].recommendationName())
            .resourceId(String.format("/subscriptions/%s", current.applyValue(getClientConfigResult -> getClientConfigResult.subscriptionId())))
            .ttl("01:00:00:00")
            .build());

    }
}
Copy
resources:
  exampleSuppression:
    type: azure:advisor:Suppression
    name: example
    properties:
      name: HardcodedSuppressionName
      recommendationId: ${test.recommendations[0].recommendationName}
      resourceId: /subscriptions/${current.subscriptionId}
      ttl: 01:00:00:00
variables:
  current:
    fn::invoke:
      function: azure:core:getClientConfig
      arguments: {}
  example:
    fn::invoke:
      function: azure:advisor:getRecommendations
      arguments: {}
Copy

Create Suppression Resource

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

Constructor syntax

new Suppression(name: string, args: SuppressionArgs, opts?: CustomResourceOptions);
@overload
def Suppression(resource_name: str,
                args: SuppressionArgs,
                opts: Optional[ResourceOptions] = None)

@overload
def Suppression(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                recommendation_id: Optional[str] = None,
                resource_id: Optional[str] = None,
                name: Optional[str] = None,
                ttl: Optional[str] = None)
func NewSuppression(ctx *Context, name string, args SuppressionArgs, opts ...ResourceOption) (*Suppression, error)
public Suppression(string name, SuppressionArgs args, CustomResourceOptions? opts = null)
public Suppression(String name, SuppressionArgs args)
public Suppression(String name, SuppressionArgs args, CustomResourceOptions options)
type: azure:advisor:Suppression
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. SuppressionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. SuppressionArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. SuppressionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. SuppressionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. SuppressionArgs
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 suppressionResource = new Azure.Advisor.Suppression("suppressionResource", new()
{
    RecommendationId = "string",
    ResourceId = "string",
    Name = "string",
    Ttl = "string",
});
Copy
example, err := advisor.NewSuppression(ctx, "suppressionResource", &advisor.SuppressionArgs{
	RecommendationId: pulumi.String("string"),
	ResourceId:       pulumi.String("string"),
	Name:             pulumi.String("string"),
	Ttl:              pulumi.String("string"),
})
Copy
var suppressionResource = new Suppression("suppressionResource", SuppressionArgs.builder()
    .recommendationId("string")
    .resourceId("string")
    .name("string")
    .ttl("string")
    .build());
Copy
suppression_resource = azure.advisor.Suppression("suppressionResource",
    recommendation_id="string",
    resource_id="string",
    name="string",
    ttl="string")
Copy
const suppressionResource = new azure.advisor.Suppression("suppressionResource", {
    recommendationId: "string",
    resourceId: "string",
    name: "string",
    ttl: "string",
});
Copy
type: azure:advisor:Suppression
properties:
    name: string
    recommendationId: string
    resourceId: string
    ttl: string
Copy

Suppression 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 Suppression resource accepts the following input properties:

RecommendationId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
ResourceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
Name Changes to this property will trigger replacement. string
The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
Ttl Changes to this property will trigger replacement. string
A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
RecommendationId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
ResourceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
Name Changes to this property will trigger replacement. string
The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
Ttl Changes to this property will trigger replacement. string
A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
recommendationId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
resourceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
name Changes to this property will trigger replacement. String
The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
ttl Changes to this property will trigger replacement. String
A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
recommendationId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
resourceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
name Changes to this property will trigger replacement. string
The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
ttl Changes to this property will trigger replacement. string
A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
recommendation_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
resource_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
name Changes to this property will trigger replacement. str
The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
ttl Changes to this property will trigger replacement. str
A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
recommendationId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
resourceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
name Changes to this property will trigger replacement. String
The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
ttl Changes to this property will trigger replacement. String
A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
SuppressionId string
The GUID of the suppression.
Id string
The provider-assigned unique ID for this managed resource.
SuppressionId string
The GUID of the suppression.
id String
The provider-assigned unique ID for this managed resource.
suppressionId String
The GUID of the suppression.
id string
The provider-assigned unique ID for this managed resource.
suppressionId string
The GUID of the suppression.
id str
The provider-assigned unique ID for this managed resource.
suppression_id str
The GUID of the suppression.
id String
The provider-assigned unique ID for this managed resource.
suppressionId String
The GUID of the suppression.

Look up Existing Suppression Resource

Get an existing Suppression 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?: SuppressionState, opts?: CustomResourceOptions): Suppression
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        name: Optional[str] = None,
        recommendation_id: Optional[str] = None,
        resource_id: Optional[str] = None,
        suppression_id: Optional[str] = None,
        ttl: Optional[str] = None) -> Suppression
func GetSuppression(ctx *Context, name string, id IDInput, state *SuppressionState, opts ...ResourceOption) (*Suppression, error)
public static Suppression Get(string name, Input<string> id, SuppressionState? state, CustomResourceOptions? opts = null)
public static Suppression get(String name, Output<String> id, SuppressionState state, CustomResourceOptions options)
resources:  _:    type: azure:advisor:Suppression    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Name Changes to this property will trigger replacement. string
The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
RecommendationId Changes to this property will trigger replacement. string
The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
ResourceId Changes to this property will trigger replacement. string
The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
SuppressionId string
The GUID of the suppression.
Ttl Changes to this property will trigger replacement. string
A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
Name Changes to this property will trigger replacement. string
The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
RecommendationId Changes to this property will trigger replacement. string
The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
ResourceId Changes to this property will trigger replacement. string
The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
SuppressionId string
The GUID of the suppression.
Ttl Changes to this property will trigger replacement. string
A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
name Changes to this property will trigger replacement. String
The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
recommendationId Changes to this property will trigger replacement. String
The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
resourceId Changes to this property will trigger replacement. String
The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
suppressionId String
The GUID of the suppression.
ttl Changes to this property will trigger replacement. String
A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
name Changes to this property will trigger replacement. string
The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
recommendationId Changes to this property will trigger replacement. string
The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
resourceId Changes to this property will trigger replacement. string
The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
suppressionId string
The GUID of the suppression.
ttl Changes to this property will trigger replacement. string
A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
name Changes to this property will trigger replacement. str
The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
recommendation_id Changes to this property will trigger replacement. str
The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
resource_id Changes to this property will trigger replacement. str
The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
suppression_id str
The GUID of the suppression.
ttl Changes to this property will trigger replacement. str
A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.
name Changes to this property will trigger replacement. String
The Name which should be used for this Advisor suppression. Changing this forces a new Advisor suppression to be created.
recommendationId Changes to this property will trigger replacement. String
The ID of the Advisor recommendation to suppress. Changing this forces a new Advisor suppression to be created.
resourceId Changes to this property will trigger replacement. String
The ID of the Resource to suppress the Advisor recommendation for. Changing this forces a new Advisor suppression to be created.
suppressionId String
The GUID of the suppression.
ttl Changes to this property will trigger replacement. String
A optional time to live value. If omitted, the suppression will not expire. Changing this forces a new Advisor suppression to be created.

Import

Advisor suppressions can be imported using the resource id, e.g.

$ pulumi import azure:advisor/suppression:Suppression example /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Advisor/recommendations/00000000-0000-0000-0000-000000000000/suppressions/name
Copy

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.