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

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
azure logo

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    Use this data source to access information about a Policy Definition, both custom and built in. Retrieves Policy Definitions from your current subscription by default.

    Example Usage

    using Pulumi;
    using Azure = Pulumi.Azure;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var example = Output.Create(Azure.Policy.GetPolicyDefintion.InvokeAsync(new Azure.Policy.GetPolicyDefintionArgs
            {
                DisplayName = "Allowed resource types",
            }));
            this.Id = example.Apply(example => example.Id);
        }
    
        [Output("id")]
        public Output<string> Id { get; set; }
    }
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/policy"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := policy.GetPolicyDefintion(ctx, &policy.GetPolicyDefintionArgs{
    			DisplayName: pulumi.StringRef("Allowed resource types"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("id", example.Id)
    		return nil
    	})
    }
    

    Example coming soon!

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = azure.policy.getPolicyDefintion({
        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(display_name="Allowed resource types")
    pulumi.export("id", example.id)
    

    Example coming soon!

    Using getPolicyDefintion

    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 getPolicyDefintion(args: GetPolicyDefintionArgs, opts?: InvokeOptions): Promise<GetPolicyDefintionResult>
    function getPolicyDefintionOutput(args: GetPolicyDefintionOutputArgs, opts?: InvokeOptions): Output<GetPolicyDefintionResult>
    def get_policy_defintion(display_name: Optional[str] = None,
                             management_group_id: Optional[str] = None,
                             management_group_name: Optional[str] = None,
                             name: Optional[str] = None,
                             opts: Optional[InvokeOptions] = None) -> GetPolicyDefintionResult
    def get_policy_defintion_output(display_name: Optional[pulumi.Input[str]] = None,
                             management_group_id: Optional[pulumi.Input[str]] = None,
                             management_group_name: Optional[pulumi.Input[str]] = None,
                             name: Optional[pulumi.Input[str]] = None,
                             opts: Optional[InvokeOptions] = None) -> Output[GetPolicyDefintionResult]
    func GetPolicyDefintion(ctx *Context, args *GetPolicyDefintionArgs, opts ...InvokeOption) (*GetPolicyDefintionResult, error)
    func GetPolicyDefintionOutput(ctx *Context, args *GetPolicyDefintionOutputArgs, opts ...InvokeOption) GetPolicyDefintionResultOutput

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

    public static class GetPolicyDefintion 
    {
        public static Task<GetPolicyDefintionResult> InvokeAsync(GetPolicyDefintionArgs args, InvokeOptions? opts = null)
        public static Output<GetPolicyDefintionResult> Invoke(GetPolicyDefintionInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetPolicyDefintionResult> getPolicyDefintion(GetPolicyDefintionArgs args, InvokeOptions options)
    public static Output<GetPolicyDefintionResult> getPolicyDefintion(GetPolicyDefintionArgs args, InvokeOptions options)
    
    fn::invoke:
      function: azure:policy/getPolicyDefintion:getPolicyDefintion
      arguments:
        # arguments dictionary

    The following arguments are supported:

    DisplayName string
    Specifies the display name of the Policy Definition. Conflicts with name.
    ManagementGroupId string

    Deprecated: Deprecated in favour of management_group_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.
    ManagementGroupId string

    Deprecated: Deprecated in favour of management_group_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.
    managementGroupId String

    Deprecated: Deprecated in favour of management_group_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.
    managementGroupId string

    Deprecated: Deprecated in favour of management_group_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.
    management_group_id str

    Deprecated: Deprecated in favour of management_group_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.
    managementGroupId String

    Deprecated: Deprecated in favour of management_group_name

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

    getPolicyDefintion 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.
    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".
    Type string
    The Type of Policy.
    ManagementGroupId string

    Deprecated: Deprecated in favour of management_group_name

    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.
    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".
    Type string
    The Type of Policy.
    ManagementGroupId string

    Deprecated: Deprecated in favour of management_group_name

    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.
    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".
    type String
    The Type of Policy.
    managementGroupId String

    Deprecated: Deprecated in favour of management_group_name

    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.
    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".
    type string
    The Type of Policy.
    managementGroupId string

    Deprecated: Deprecated in favour of management_group_name

    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.
    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".
    type str
    The Type of Policy.
    management_group_id str

    Deprecated: Deprecated in favour of management_group_name

    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.
    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".
    type String
    The Type of Policy.
    managementGroupId String

    Deprecated: Deprecated in favour of management_group_name

    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.

    Viewing docs for Azure v4.42.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.