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

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.advisor.getRecommendations

Explore with Pulumi AI

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

Use this data source to access information about an existing Advisor Recommendations.

Example Usage

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

const example = azure.advisor.getRecommendations({
    filterByCategories: [
        "security",
        "cost",
    ],
    filterByResourceGroups: ["example-resgroups"],
});
export const recommendations = example.then(example => example.recommendations);
Copy
import pulumi
import pulumi_azure as azure

example = azure.advisor.get_recommendations(filter_by_categories=[
        "security",
        "cost",
    ],
    filter_by_resource_groups=["example-resgroups"])
pulumi.export("recommendations", example.recommendations)
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := advisor.GetRecommendations(ctx, &advisor.GetRecommendationsArgs{
			FilterByCategories: []string{
				"security",
				"cost",
			},
			FilterByResourceGroups: []string{
				"example-resgroups",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("recommendations", example.Recommendations)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = Azure.Advisor.GetRecommendations.Invoke(new()
    {
        FilterByCategories = new[]
        {
            "security",
            "cost",
        },
        FilterByResourceGroups = new[]
        {
            "example-resgroups",
        },
    });

    return new Dictionary<string, object?>
    {
        ["recommendations"] = example.Apply(getRecommendationsResult => getRecommendationsResult.Recommendations),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.advisor.AdvisorFunctions;
import com.pulumi.azure.advisor.inputs.GetRecommendationsArgs;
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 example = AdvisorFunctions.getRecommendations(GetRecommendationsArgs.builder()
            .filterByCategories(            
                "security",
                "cost")
            .filterByResourceGroups("example-resgroups")
            .build());

        ctx.export("recommendations", example.applyValue(getRecommendationsResult -> getRecommendationsResult.recommendations()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: azure:advisor:getRecommendations
      arguments:
        filterByCategories:
          - security
          - cost
        filterByResourceGroups:
          - example-resgroups
outputs:
  recommendations: ${example.recommendations}
Copy

Using getRecommendations

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getRecommendations(args: GetRecommendationsArgs, opts?: InvokeOptions): Promise<GetRecommendationsResult>
function getRecommendationsOutput(args: GetRecommendationsOutputArgs, opts?: InvokeOptions): Output<GetRecommendationsResult>
Copy
def get_recommendations(filter_by_categories: Optional[Sequence[str]] = None,
                        filter_by_resource_groups: Optional[Sequence[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> GetRecommendationsResult
def get_recommendations_output(filter_by_categories: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                        filter_by_resource_groups: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetRecommendationsResult]
Copy
func GetRecommendations(ctx *Context, args *GetRecommendationsArgs, opts ...InvokeOption) (*GetRecommendationsResult, error)
func GetRecommendationsOutput(ctx *Context, args *GetRecommendationsOutputArgs, opts ...InvokeOption) GetRecommendationsResultOutput
Copy

> Note: This function is named GetRecommendations in the Go SDK.

public static class GetRecommendations 
{
    public static Task<GetRecommendationsResult> InvokeAsync(GetRecommendationsArgs args, InvokeOptions? opts = null)
    public static Output<GetRecommendationsResult> Invoke(GetRecommendationsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetRecommendationsResult> getRecommendations(GetRecommendationsArgs args, InvokeOptions options)
public static Output<GetRecommendationsResult> getRecommendations(GetRecommendationsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azure:advisor/getRecommendations:getRecommendations
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

FilterByCategories List<string>
Specifies a list of categories in which the Advisor Recommendations will be listed. Possible values are HighAvailability, Security, Performance, Cost and OperationalExcellence.
FilterByResourceGroups List<string>
Specifies a list of resource groups about which the Advisor Recommendations will be listed.
FilterByCategories []string
Specifies a list of categories in which the Advisor Recommendations will be listed. Possible values are HighAvailability, Security, Performance, Cost and OperationalExcellence.
FilterByResourceGroups []string
Specifies a list of resource groups about which the Advisor Recommendations will be listed.
filterByCategories List<String>
Specifies a list of categories in which the Advisor Recommendations will be listed. Possible values are HighAvailability, Security, Performance, Cost and OperationalExcellence.
filterByResourceGroups List<String>
Specifies a list of resource groups about which the Advisor Recommendations will be listed.
filterByCategories string[]
Specifies a list of categories in which the Advisor Recommendations will be listed. Possible values are HighAvailability, Security, Performance, Cost and OperationalExcellence.
filterByResourceGroups string[]
Specifies a list of resource groups about which the Advisor Recommendations will be listed.
filter_by_categories Sequence[str]
Specifies a list of categories in which the Advisor Recommendations will be listed. Possible values are HighAvailability, Security, Performance, Cost and OperationalExcellence.
filter_by_resource_groups Sequence[str]
Specifies a list of resource groups about which the Advisor Recommendations will be listed.
filterByCategories List<String>
Specifies a list of categories in which the Advisor Recommendations will be listed. Possible values are HighAvailability, Security, Performance, Cost and OperationalExcellence.
filterByResourceGroups List<String>
Specifies a list of resource groups about which the Advisor Recommendations will be listed.

getRecommendations Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Recommendations List<GetRecommendationsRecommendation>
One or more recommendations blocks as defined below.
FilterByCategories List<string>
FilterByResourceGroups List<string>
Id string
The provider-assigned unique ID for this managed resource.
Recommendations []GetRecommendationsRecommendation
One or more recommendations blocks as defined below.
FilterByCategories []string
FilterByResourceGroups []string
id String
The provider-assigned unique ID for this managed resource.
recommendations List<GetRecommendationsRecommendation>
One or more recommendations blocks as defined below.
filterByCategories List<String>
filterByResourceGroups List<String>
id string
The provider-assigned unique ID for this managed resource.
recommendations GetRecommendationsRecommendation[]
One or more recommendations blocks as defined below.
filterByCategories string[]
filterByResourceGroups string[]
id str
The provider-assigned unique ID for this managed resource.
recommendations Sequence[GetRecommendationsRecommendation]
One or more recommendations blocks as defined below.
filter_by_categories Sequence[str]
filter_by_resource_groups Sequence[str]
id String
The provider-assigned unique ID for this managed resource.
recommendations List<Property Map>
One or more recommendations blocks as defined below.
filterByCategories List<String>
filterByResourceGroups List<String>

Supporting Types

GetRecommendationsRecommendation

Category This property is required. string
The category of the recommendation.
Description This property is required. string
The description of the issue or the opportunity identified by the recommendation.
Impact This property is required. string
The business impact of the recommendation.
RecommendationName This property is required. string
The name of the Advisor Recommendation.
RecommendationTypeId This property is required. string
The recommendation type id of the Advisor Recommendation.
ResourceName This property is required. string
The name of the identified resource of the Advisor Recommendation.
ResourceType This property is required. string
The type of the identified resource of the Advisor Recommendation.
SuppressionNames This property is required. List<string>
A list of Advisor Suppression names of the Advisor Recommendation.
UpdatedTime This property is required. string
The most recent time that Advisor checked the validity of the recommendation..
Category This property is required. string
The category of the recommendation.
Description This property is required. string
The description of the issue or the opportunity identified by the recommendation.
Impact This property is required. string
The business impact of the recommendation.
RecommendationName This property is required. string
The name of the Advisor Recommendation.
RecommendationTypeId This property is required. string
The recommendation type id of the Advisor Recommendation.
ResourceName This property is required. string
The name of the identified resource of the Advisor Recommendation.
ResourceType This property is required. string
The type of the identified resource of the Advisor Recommendation.
SuppressionNames This property is required. []string
A list of Advisor Suppression names of the Advisor Recommendation.
UpdatedTime This property is required. string
The most recent time that Advisor checked the validity of the recommendation..
category This property is required. String
The category of the recommendation.
description This property is required. String
The description of the issue or the opportunity identified by the recommendation.
impact This property is required. String
The business impact of the recommendation.
recommendationName This property is required. String
The name of the Advisor Recommendation.
recommendationTypeId This property is required. String
The recommendation type id of the Advisor Recommendation.
resourceName This property is required. String
The name of the identified resource of the Advisor Recommendation.
resourceType This property is required. String
The type of the identified resource of the Advisor Recommendation.
suppressionNames This property is required. List<String>
A list of Advisor Suppression names of the Advisor Recommendation.
updatedTime This property is required. String
The most recent time that Advisor checked the validity of the recommendation..
category This property is required. string
The category of the recommendation.
description This property is required. string
The description of the issue or the opportunity identified by the recommendation.
impact This property is required. string
The business impact of the recommendation.
recommendationName This property is required. string
The name of the Advisor Recommendation.
recommendationTypeId This property is required. string
The recommendation type id of the Advisor Recommendation.
resourceName This property is required. string
The name of the identified resource of the Advisor Recommendation.
resourceType This property is required. string
The type of the identified resource of the Advisor Recommendation.
suppressionNames This property is required. string[]
A list of Advisor Suppression names of the Advisor Recommendation.
updatedTime This property is required. string
The most recent time that Advisor checked the validity of the recommendation..
category This property is required. str
The category of the recommendation.
description This property is required. str
The description of the issue or the opportunity identified by the recommendation.
impact This property is required. str
The business impact of the recommendation.
recommendation_name This property is required. str
The name of the Advisor Recommendation.
recommendation_type_id This property is required. str
The recommendation type id of the Advisor Recommendation.
resource_name This property is required. str
The name of the identified resource of the Advisor Recommendation.
resource_type This property is required. str
The type of the identified resource of the Advisor Recommendation.
suppression_names This property is required. Sequence[str]
A list of Advisor Suppression names of the Advisor Recommendation.
updated_time This property is required. str
The most recent time that Advisor checked the validity of the recommendation..
category This property is required. String
The category of the recommendation.
description This property is required. String
The description of the issue or the opportunity identified by the recommendation.
impact This property is required. String
The business impact of the recommendation.
recommendationName This property is required. String
The name of the Advisor Recommendation.
recommendationTypeId This property is required. String
The recommendation type id of the Advisor Recommendation.
resourceName This property is required. String
The name of the identified resource of the Advisor Recommendation.
resourceType This property is required. String
The type of the identified resource of the Advisor Recommendation.
suppressionNames This property is required. List<String>
A list of Advisor Suppression names of the Advisor Recommendation.
updatedTime This property is required. String
The most recent time that Advisor checked the validity of the recommendation..

Package Details

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

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi