1. Packages
  2. Azure Classic
  3. API Docs
  4. policy
  5. getPolicyDefintionBuiltIn

We recommend using Azure Native.

Azure Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi

azure.policy.getPolicyDefintionBuiltIn

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi

    Use this data source to access information about a Built-In Policy Definition. Retrieves Policy Definitions from your current subscription by default.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = azure.policy.getPolicyDefintionBuiltIn({
        displayName: "Allowed resource types",
    });
    export const id = example.then(example => example.id);
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.policy.get_policy_defintion_built_in(display_name="Allowed resource types")
    pulumi.export("id", example.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/policy"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := policy.GetPolicyDefintionBuiltIn(ctx, &policy.GetPolicyDefintionBuiltInArgs{
    			DisplayName: pulumi.StringRef("Allowed resource types"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("id", example.Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Azure.Policy.GetPolicyDefintionBuiltIn.Invoke(new()
        {
            DisplayName = "Allowed resource types",
        });
    
        return new Dictionary<string, object?>
        {
            ["id"] = example.Apply(getPolicyDefintionBuiltInResult => getPolicyDefintionBuiltInResult.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.policy.PolicyFunctions;
    import com.pulumi.azure.policy.inputs.GetPolicyDefintionBuiltInArgs;
    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 = PolicyFunctions.getPolicyDefintionBuiltIn(GetPolicyDefintionBuiltInArgs.builder()
                .displayName("Allowed resource types")
                .build());
    
            ctx.export("id", example.applyValue(getPolicyDefintionBuiltInResult -> getPolicyDefintionBuiltInResult.id()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: azure:policy:getPolicyDefintionBuiltIn
          Arguments:
            displayName: Allowed resource types
    outputs:
      id: ${example.id}
    

    Using getPolicyDefintionBuiltIn

    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 getPolicyDefintionBuiltIn(args: GetPolicyDefintionBuiltInArgs, opts?: InvokeOptions): Promise<GetPolicyDefintionBuiltInResult>
    function getPolicyDefintionBuiltInOutput(args: GetPolicyDefintionBuiltInOutputArgs, opts?: InvokeOptions): Output<GetPolicyDefintionBuiltInResult>
    def get_policy_defintion_built_in(display_name: Optional[str] = None,
                                      management_group_name: Optional[str] = None,
                                      name: Optional[str] = None,
                                      opts: Optional[InvokeOptions] = None) -> GetPolicyDefintionBuiltInResult
    def get_policy_defintion_built_in_output(display_name: Optional[pulumi.Input[str]] = None,
                                      management_group_name: Optional[pulumi.Input[str]] = None,
                                      name: Optional[pulumi.Input[str]] = None,
                                      opts: Optional[InvokeOptions] = None) -> Output[GetPolicyDefintionBuiltInResult]
    func GetPolicyDefintionBuiltIn(ctx *Context, args *GetPolicyDefintionBuiltInArgs, opts ...InvokeOption) (*GetPolicyDefintionBuiltInResult, error)
    func GetPolicyDefintionBuiltInOutput(ctx *Context, args *GetPolicyDefintionBuiltInOutputArgs, opts ...InvokeOption) GetPolicyDefintionBuiltInResultOutput

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

    public static class GetPolicyDefintionBuiltIn 
    {
        public static Task<GetPolicyDefintionBuiltInResult> InvokeAsync(GetPolicyDefintionBuiltInArgs args, InvokeOptions? opts = null)
        public static Output<GetPolicyDefintionBuiltInResult> Invoke(GetPolicyDefintionBuiltInInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetPolicyDefintionBuiltInResult> getPolicyDefintionBuiltIn(GetPolicyDefintionBuiltInArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: azure:policy/getPolicyDefintionBuiltIn:getPolicyDefintionBuiltIn
      arguments:
        # arguments dictionary

    The following arguments are supported:

    DisplayName string

    Specifies the display name of the Policy Definition. Conflicts with name.

    NOTE As display_name is not unique errors may occur when there are multiple policy definitions with same display name.

    ManagementGroupName string
    Only retrieve Policy Definitions from this Management Group.
    Name string
    Specifies the name of the Policy Definition. Conflicts with display_name.
    DisplayName string

    Specifies the display name of the Policy Definition. Conflicts with name.

    NOTE As display_name is not unique errors may occur when there are multiple policy definitions with same display name.

    ManagementGroupName string
    Only retrieve Policy Definitions from this Management Group.
    Name string
    Specifies the name of the Policy Definition. Conflicts with display_name.
    displayName String

    Specifies the display name of the Policy Definition. Conflicts with name.

    NOTE As display_name is not unique errors may occur when there are multiple policy definitions with same display name.

    managementGroupName String
    Only retrieve Policy Definitions from this Management Group.
    name String
    Specifies the name of the Policy Definition. Conflicts with display_name.
    displayName string

    Specifies the display name of the Policy Definition. Conflicts with name.

    NOTE As display_name is not unique errors may occur when there are multiple policy definitions with same display name.

    managementGroupName string
    Only retrieve Policy Definitions from this Management Group.
    name string
    Specifies the name of the Policy Definition. Conflicts with display_name.
    display_name str

    Specifies the display name of the Policy Definition. Conflicts with name.

    NOTE As display_name is not unique errors may occur when there are multiple policy definitions with same display name.

    management_group_name str
    Only retrieve Policy Definitions from this Management Group.
    name str
    Specifies the name of the Policy Definition. Conflicts with display_name.
    displayName String

    Specifies the display name of the Policy Definition. Conflicts with name.

    NOTE As display_name is not unique errors may occur when there are multiple policy definitions with same display name.

    managementGroupName String
    Only retrieve Policy Definitions from this Management Group.
    name String
    Specifies the name of the Policy Definition. Conflicts with display_name.

    getPolicyDefintionBuiltIn Result

    The following output properties are available:

    Description string
    The Description of the Policy.
    DisplayName string
    Id string
    The provider-assigned unique ID for this managed resource.
    Metadata string
    Any Metadata defined in the Policy.
    Mode string
    The Mode of the Policy.
    Name string
    Parameters string
    Any Parameters defined in the Policy.
    PolicyRule string
    The Rule as defined (in JSON) in the Policy.
    PolicyType string
    The Type of the Policy. Possible values are BuiltIn, Custom and NotSpecified.
    RoleDefinitionIds List<string>
    A list of role definition id extracted from policy_rule required for remediation.
    Type string
    The Type of Policy.
    ManagementGroupName string
    Description string
    The Description of the Policy.
    DisplayName string
    Id string
    The provider-assigned unique ID for this managed resource.
    Metadata string
    Any Metadata defined in the Policy.
    Mode string
    The Mode of the Policy.
    Name string
    Parameters string
    Any Parameters defined in the Policy.
    PolicyRule string
    The Rule as defined (in JSON) in the Policy.
    PolicyType string
    The Type of the Policy. Possible values are BuiltIn, Custom and NotSpecified.
    RoleDefinitionIds []string
    A list of role definition id extracted from policy_rule required for remediation.
    Type string
    The Type of Policy.
    ManagementGroupName string
    description String
    The Description of the Policy.
    displayName String
    id String
    The provider-assigned unique ID for this managed resource.
    metadata String
    Any Metadata defined in the Policy.
    mode String
    The Mode of the Policy.
    name String
    parameters String
    Any Parameters defined in the Policy.
    policyRule String
    The Rule as defined (in JSON) in the Policy.
    policyType String
    The Type of the Policy. Possible values are BuiltIn, Custom and NotSpecified.
    roleDefinitionIds List<String>
    A list of role definition id extracted from policy_rule required for remediation.
    type String
    The Type of Policy.
    managementGroupName String
    description string
    The Description of the Policy.
    displayName string
    id string
    The provider-assigned unique ID for this managed resource.
    metadata string
    Any Metadata defined in the Policy.
    mode string
    The Mode of the Policy.
    name string
    parameters string
    Any Parameters defined in the Policy.
    policyRule string
    The Rule as defined (in JSON) in the Policy.
    policyType string
    The Type of the Policy. Possible values are BuiltIn, Custom and NotSpecified.
    roleDefinitionIds string[]
    A list of role definition id extracted from policy_rule required for remediation.
    type string
    The Type of Policy.
    managementGroupName string
    description str
    The Description of the Policy.
    display_name str
    id str
    The provider-assigned unique ID for this managed resource.
    metadata str
    Any Metadata defined in the Policy.
    mode str
    The Mode of the Policy.
    name str
    parameters str
    Any Parameters defined in the Policy.
    policy_rule str
    The Rule as defined (in JSON) in the Policy.
    policy_type str
    The Type of the Policy. Possible values are BuiltIn, Custom and NotSpecified.
    role_definition_ids Sequence[str]
    A list of role definition id extracted from policy_rule required for remediation.
    type str
    The Type of Policy.
    management_group_name str
    description String
    The Description of the Policy.
    displayName String
    id String
    The provider-assigned unique ID for this managed resource.
    metadata String
    Any Metadata defined in the Policy.
    mode String
    The Mode of the Policy.
    name String
    parameters String
    Any Parameters defined in the Policy.
    policyRule String
    The Rule as defined (in JSON) in the Policy.
    policyType String
    The Type of the Policy. Possible values are BuiltIn, Custom and NotSpecified.
    roleDefinitionIds List<String>
    A list of role definition id extracted from policy_rule required for remediation.
    type String
    The Type of Policy.
    managementGroupName String

    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 Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi