1. Packages
  2. Azure Classic
  3. API Docs
  4. core
  5. ResourcePolicyAssignment

We recommend using Azure Native.

Azure Classic v5.49.0 published on Tuesday, Aug 29, 2023 by Pulumi

azure.core.ResourcePolicyAssignment

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.49.0 published on Tuesday, Aug 29, 2023 by Pulumi

    Manages a Policy Assignment to a Resource.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleVirtualNetwork = Azure.Network.GetVirtualNetwork.Invoke(new()
        {
            Name = "production",
            ResourceGroupName = "networking",
        });
    
        var exampleDefinition = new Azure.Policy.Definition("exampleDefinition", new()
        {
            PolicyType = "Custom",
            Mode = "All",
            DisplayName = "my-policy-definition",
            PolicyRule = @" {
        ""if"": {
          ""not"": {
            ""field"": ""location"",
            ""equals"": ""westeurope""
          }
        },
        ""then"": {
          ""effect"": ""Deny""
        }
      }
    ",
        });
    
        var exampleResourcePolicyAssignment = new Azure.Core.ResourcePolicyAssignment("exampleResourcePolicyAssignment", new()
        {
            ResourceId = exampleVirtualNetwork.Apply(getVirtualNetworkResult => getVirtualNetworkResult.Id),
            PolicyDefinitionId = exampleDefinition.Id,
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/policy"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleVirtualNetwork, err := network.LookupVirtualNetwork(ctx, &network.LookupVirtualNetworkArgs{
    			Name:              "production",
    			ResourceGroupName: "networking",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleDefinition, err := policy.NewDefinition(ctx, "exampleDefinition", &policy.DefinitionArgs{
    			PolicyType:  pulumi.String("Custom"),
    			Mode:        pulumi.String("All"),
    			DisplayName: pulumi.String("my-policy-definition"),
    			PolicyRule: pulumi.String(` {
        "if": {
          "not": {
            "field": "location",
            "equals": "westeurope"
          }
        },
        "then": {
          "effect": "Deny"
        }
      }
    `),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = core.NewResourcePolicyAssignment(ctx, "exampleResourcePolicyAssignment", &core.ResourcePolicyAssignmentArgs{
    			ResourceId:         *pulumi.String(exampleVirtualNetwork.Id),
    			PolicyDefinitionId: exampleDefinition.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.network.NetworkFunctions;
    import com.pulumi.azure.network.inputs.GetVirtualNetworkArgs;
    import com.pulumi.azure.policy.Definition;
    import com.pulumi.azure.policy.DefinitionArgs;
    import com.pulumi.azure.core.ResourcePolicyAssignment;
    import com.pulumi.azure.core.ResourcePolicyAssignmentArgs;
    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 exampleVirtualNetwork = NetworkFunctions.getVirtualNetwork(GetVirtualNetworkArgs.builder()
                .name("production")
                .resourceGroupName("networking")
                .build());
    
            var exampleDefinition = new Definition("exampleDefinition", DefinitionArgs.builder()        
                .policyType("Custom")
                .mode("All")
                .displayName("my-policy-definition")
                .policyRule("""
     {
        "if": {
          "not": {
            "field": "location",
            "equals": "westeurope"
          }
        },
        "then": {
          "effect": "Deny"
        }
      }
                """)
                .build());
    
            var exampleResourcePolicyAssignment = new ResourcePolicyAssignment("exampleResourcePolicyAssignment", ResourcePolicyAssignmentArgs.builder()        
                .resourceId(exampleVirtualNetwork.applyValue(getVirtualNetworkResult -> getVirtualNetworkResult.id()))
                .policyDefinitionId(exampleDefinition.id())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_azure as azure
    
    example_virtual_network = azure.network.get_virtual_network(name="production",
        resource_group_name="networking")
    example_definition = azure.policy.Definition("exampleDefinition",
        policy_type="Custom",
        mode="All",
        display_name="my-policy-definition",
        policy_rule=""" {
        "if": {
          "not": {
            "field": "location",
            "equals": "westeurope"
          }
        },
        "then": {
          "effect": "Deny"
        }
      }
    """)
    example_resource_policy_assignment = azure.core.ResourcePolicyAssignment("exampleResourcePolicyAssignment",
        resource_id=example_virtual_network.id,
        policy_definition_id=example_definition.id)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const exampleVirtualNetwork = azure.network.getVirtualNetwork({
        name: "production",
        resourceGroupName: "networking",
    });
    const exampleDefinition = new azure.policy.Definition("exampleDefinition", {
        policyType: "Custom",
        mode: "All",
        displayName: "my-policy-definition",
        policyRule: ` {
        "if": {
          "not": {
            "field": "location",
            "equals": "westeurope"
          }
        },
        "then": {
          "effect": "Deny"
        }
      }
    `,
    });
    const exampleResourcePolicyAssignment = new azure.core.ResourcePolicyAssignment("exampleResourcePolicyAssignment", {
        resourceId: exampleVirtualNetwork.then(exampleVirtualNetwork => exampleVirtualNetwork.id),
        policyDefinitionId: exampleDefinition.id,
    });
    
    resources:
      exampleDefinition:
        type: azure:policy:Definition
        properties:
          policyType: Custom
          mode: All
          displayName: my-policy-definition
          policyRule: |2
             {
                "if": {
                  "not": {
                    "field": "location",
                    "equals": "westeurope"
                  }
                },
                "then": {
                  "effect": "Deny"
                }
              }
      exampleResourcePolicyAssignment:
        type: azure:core:ResourcePolicyAssignment
        properties:
          resourceId: ${exampleVirtualNetwork.id}
          policyDefinitionId: ${exampleDefinition.id}
    variables:
      exampleVirtualNetwork:
        fn::invoke:
          Function: azure:network:getVirtualNetwork
          Arguments:
            name: production
            resourceGroupName: networking
    

    Create ResourcePolicyAssignment Resource

    new ResourcePolicyAssignment(name: string, args: ResourcePolicyAssignmentArgs, opts?: CustomResourceOptions);
    @overload
    def ResourcePolicyAssignment(resource_name: str,
                                 opts: Optional[ResourceOptions] = None,
                                 description: Optional[str] = None,
                                 display_name: Optional[str] = None,
                                 enforce: Optional[bool] = None,
                                 identity: Optional[ResourcePolicyAssignmentIdentityArgs] = None,
                                 location: Optional[str] = None,
                                 metadata: Optional[str] = None,
                                 name: Optional[str] = None,
                                 non_compliance_messages: Optional[Sequence[ResourcePolicyAssignmentNonComplianceMessageArgs]] = None,
                                 not_scopes: Optional[Sequence[str]] = None,
                                 overrides: Optional[Sequence[ResourcePolicyAssignmentOverrideArgs]] = None,
                                 parameters: Optional[str] = None,
                                 policy_definition_id: Optional[str] = None,
                                 resource_id: Optional[str] = None,
                                 resource_selectors: Optional[Sequence[ResourcePolicyAssignmentResourceSelectorArgs]] = None)
    @overload
    def ResourcePolicyAssignment(resource_name: str,
                                 args: ResourcePolicyAssignmentArgs,
                                 opts: Optional[ResourceOptions] = None)
    func NewResourcePolicyAssignment(ctx *Context, name string, args ResourcePolicyAssignmentArgs, opts ...ResourceOption) (*ResourcePolicyAssignment, error)
    public ResourcePolicyAssignment(string name, ResourcePolicyAssignmentArgs args, CustomResourceOptions? opts = null)
    public ResourcePolicyAssignment(String name, ResourcePolicyAssignmentArgs args)
    public ResourcePolicyAssignment(String name, ResourcePolicyAssignmentArgs args, CustomResourceOptions options)
    
    type: azure:core:ResourcePolicyAssignment
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args ResourcePolicyAssignmentArgs
    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 ResourcePolicyAssignmentArgs
    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 ResourcePolicyAssignmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ResourcePolicyAssignmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ResourcePolicyAssignmentArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    ResourcePolicyAssignment Resource Properties

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

    Inputs

    The ResourcePolicyAssignment resource accepts the following input properties:

    PolicyDefinitionId string

    The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.

    ResourceId string

    The ID of the Resource (or Resource Scope) where this should be applied. Changing this forces a new Resource Policy Assignment to be created.

    To create a Policy Assignment at a Management Group use the azure.management.GroupPolicyAssignment resource, for a Resource Group use the azure.core.ResourceGroupPolicyAssignment and for a Subscription use the azure.core.SubscriptionPolicyAssignment resource.

    Description string

    A description which should be used for this Policy Assignment.

    DisplayName string

    The Display Name for this Policy Assignment.

    Enforce bool

    Specifies if this Policy should be enforced or not? Defaults to true.

    Identity ResourcePolicyAssignmentIdentity

    An identity block as defined below.

    Note: The location field must also be specified when identity is specified.

    Location string

    The Azure Region where the Policy Assignment should exist. Changing this forces a new Policy Assignment to be created.

    Metadata string

    A JSON mapping of any Metadata for this Policy.

    Name string

    The name which should be used for this Policy Assignment. Changing this forces a new Resource Policy Assignment to be created. Cannot exceed 64 characters in length.

    NonComplianceMessages List<ResourcePolicyAssignmentNonComplianceMessage>

    One or more non_compliance_message blocks as defined below.

    NotScopes List<string>

    Specifies a list of Resource Scopes (for example a Subscription, or a Resource Group) within this Management Group which are excluded from this Policy.

    Overrides List<ResourcePolicyAssignmentOverride>

    One or more overrides blocks as defined below. More detail about overrides and resource_selectors see policy assignment structure

    Parameters string

    A JSON mapping of any Parameters for this Policy.

    ResourceSelectors List<ResourcePolicyAssignmentResourceSelector>

    One or more resource_selectors blocks as defined below to filter polices by resource properties.

    PolicyDefinitionId string

    The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.

    ResourceId string

    The ID of the Resource (or Resource Scope) where this should be applied. Changing this forces a new Resource Policy Assignment to be created.

    To create a Policy Assignment at a Management Group use the azure.management.GroupPolicyAssignment resource, for a Resource Group use the azure.core.ResourceGroupPolicyAssignment and for a Subscription use the azure.core.SubscriptionPolicyAssignment resource.

    Description string

    A description which should be used for this Policy Assignment.

    DisplayName string

    The Display Name for this Policy Assignment.

    Enforce bool

    Specifies if this Policy should be enforced or not? Defaults to true.

    Identity ResourcePolicyAssignmentIdentityArgs

    An identity block as defined below.

    Note: The location field must also be specified when identity is specified.

    Location string

    The Azure Region where the Policy Assignment should exist. Changing this forces a new Policy Assignment to be created.

    Metadata string

    A JSON mapping of any Metadata for this Policy.

    Name string

    The name which should be used for this Policy Assignment. Changing this forces a new Resource Policy Assignment to be created. Cannot exceed 64 characters in length.

    NonComplianceMessages []ResourcePolicyAssignmentNonComplianceMessageArgs

    One or more non_compliance_message blocks as defined below.

    NotScopes []string

    Specifies a list of Resource Scopes (for example a Subscription, or a Resource Group) within this Management Group which are excluded from this Policy.

    Overrides []ResourcePolicyAssignmentOverrideArgs

    One or more overrides blocks as defined below. More detail about overrides and resource_selectors see policy assignment structure

    Parameters string

    A JSON mapping of any Parameters for this Policy.

    ResourceSelectors []ResourcePolicyAssignmentResourceSelectorArgs

    One or more resource_selectors blocks as defined below to filter polices by resource properties.

    policyDefinitionId String

    The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.

    resourceId String

    The ID of the Resource (or Resource Scope) where this should be applied. Changing this forces a new Resource Policy Assignment to be created.

    To create a Policy Assignment at a Management Group use the azure.management.GroupPolicyAssignment resource, for a Resource Group use the azure.core.ResourceGroupPolicyAssignment and for a Subscription use the azure.core.SubscriptionPolicyAssignment resource.

    description String

    A description which should be used for this Policy Assignment.

    displayName String

    The Display Name for this Policy Assignment.

    enforce Boolean

    Specifies if this Policy should be enforced or not? Defaults to true.

    identity ResourcePolicyAssignmentIdentity

    An identity block as defined below.

    Note: The location field must also be specified when identity is specified.

    location String

    The Azure Region where the Policy Assignment should exist. Changing this forces a new Policy Assignment to be created.

    metadata String

    A JSON mapping of any Metadata for this Policy.

    name String

    The name which should be used for this Policy Assignment. Changing this forces a new Resource Policy Assignment to be created. Cannot exceed 64 characters in length.

    nonComplianceMessages List<ResourcePolicyAssignmentNonComplianceMessage>

    One or more non_compliance_message blocks as defined below.

    notScopes List<String>

    Specifies a list of Resource Scopes (for example a Subscription, or a Resource Group) within this Management Group which are excluded from this Policy.

    overrides List<ResourcePolicyAssignmentOverride>

    One or more overrides blocks as defined below. More detail about overrides and resource_selectors see policy assignment structure

    parameters String

    A JSON mapping of any Parameters for this Policy.

    resourceSelectors List<ResourcePolicyAssignmentResourceSelector>

    One or more resource_selectors blocks as defined below to filter polices by resource properties.

    policyDefinitionId string

    The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.

    resourceId string

    The ID of the Resource (or Resource Scope) where this should be applied. Changing this forces a new Resource Policy Assignment to be created.

    To create a Policy Assignment at a Management Group use the azure.management.GroupPolicyAssignment resource, for a Resource Group use the azure.core.ResourceGroupPolicyAssignment and for a Subscription use the azure.core.SubscriptionPolicyAssignment resource.

    description string

    A description which should be used for this Policy Assignment.

    displayName string

    The Display Name for this Policy Assignment.

    enforce boolean

    Specifies if this Policy should be enforced or not? Defaults to true.

    identity ResourcePolicyAssignmentIdentity

    An identity block as defined below.

    Note: The location field must also be specified when identity is specified.

    location string

    The Azure Region where the Policy Assignment should exist. Changing this forces a new Policy Assignment to be created.

    metadata string

    A JSON mapping of any Metadata for this Policy.

    name string

    The name which should be used for this Policy Assignment. Changing this forces a new Resource Policy Assignment to be created. Cannot exceed 64 characters in length.

    nonComplianceMessages ResourcePolicyAssignmentNonComplianceMessage[]

    One or more non_compliance_message blocks as defined below.

    notScopes string[]

    Specifies a list of Resource Scopes (for example a Subscription, or a Resource Group) within this Management Group which are excluded from this Policy.

    overrides ResourcePolicyAssignmentOverride[]

    One or more overrides blocks as defined below. More detail about overrides and resource_selectors see policy assignment structure

    parameters string

    A JSON mapping of any Parameters for this Policy.

    resourceSelectors ResourcePolicyAssignmentResourceSelector[]

    One or more resource_selectors blocks as defined below to filter polices by resource properties.

    policy_definition_id str

    The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.

    resource_id str

    The ID of the Resource (or Resource Scope) where this should be applied. Changing this forces a new Resource Policy Assignment to be created.

    To create a Policy Assignment at a Management Group use the azure.management.GroupPolicyAssignment resource, for a Resource Group use the azure.core.ResourceGroupPolicyAssignment and for a Subscription use the azure.core.SubscriptionPolicyAssignment resource.

    description str

    A description which should be used for this Policy Assignment.

    display_name str

    The Display Name for this Policy Assignment.

    enforce bool

    Specifies if this Policy should be enforced or not? Defaults to true.

    identity ResourcePolicyAssignmentIdentityArgs

    An identity block as defined below.

    Note: The location field must also be specified when identity is specified.

    location str

    The Azure Region where the Policy Assignment should exist. Changing this forces a new Policy Assignment to be created.

    metadata str

    A JSON mapping of any Metadata for this Policy.

    name str

    The name which should be used for this Policy Assignment. Changing this forces a new Resource Policy Assignment to be created. Cannot exceed 64 characters in length.

    non_compliance_messages Sequence[ResourcePolicyAssignmentNonComplianceMessageArgs]

    One or more non_compliance_message blocks as defined below.

    not_scopes Sequence[str]

    Specifies a list of Resource Scopes (for example a Subscription, or a Resource Group) within this Management Group which are excluded from this Policy.

    overrides Sequence[ResourcePolicyAssignmentOverrideArgs]

    One or more overrides blocks as defined below. More detail about overrides and resource_selectors see policy assignment structure

    parameters str

    A JSON mapping of any Parameters for this Policy.

    resource_selectors Sequence[ResourcePolicyAssignmentResourceSelectorArgs]

    One or more resource_selectors blocks as defined below to filter polices by resource properties.

    policyDefinitionId String

    The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.

    resourceId String

    The ID of the Resource (or Resource Scope) where this should be applied. Changing this forces a new Resource Policy Assignment to be created.

    To create a Policy Assignment at a Management Group use the azure.management.GroupPolicyAssignment resource, for a Resource Group use the azure.core.ResourceGroupPolicyAssignment and for a Subscription use the azure.core.SubscriptionPolicyAssignment resource.

    description String

    A description which should be used for this Policy Assignment.

    displayName String

    The Display Name for this Policy Assignment.

    enforce Boolean

    Specifies if this Policy should be enforced or not? Defaults to true.

    identity Property Map

    An identity block as defined below.

    Note: The location field must also be specified when identity is specified.

    location String

    The Azure Region where the Policy Assignment should exist. Changing this forces a new Policy Assignment to be created.

    metadata String

    A JSON mapping of any Metadata for this Policy.

    name String

    The name which should be used for this Policy Assignment. Changing this forces a new Resource Policy Assignment to be created. Cannot exceed 64 characters in length.

    nonComplianceMessages List<Property Map>

    One or more non_compliance_message blocks as defined below.

    notScopes List<String>

    Specifies a list of Resource Scopes (for example a Subscription, or a Resource Group) within this Management Group which are excluded from this Policy.

    overrides List<Property Map>

    One or more overrides blocks as defined below. More detail about overrides and resource_selectors see policy assignment structure

    parameters String

    A JSON mapping of any Parameters for this Policy.

    resourceSelectors List<Property Map>

    One or more resource_selectors blocks as defined below to filter polices by resource properties.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ResourcePolicyAssignment 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 ResourcePolicyAssignment Resource

    Get an existing ResourcePolicyAssignment 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?: ResourcePolicyAssignmentState, opts?: CustomResourceOptions): ResourcePolicyAssignment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            display_name: Optional[str] = None,
            enforce: Optional[bool] = None,
            identity: Optional[ResourcePolicyAssignmentIdentityArgs] = None,
            location: Optional[str] = None,
            metadata: Optional[str] = None,
            name: Optional[str] = None,
            non_compliance_messages: Optional[Sequence[ResourcePolicyAssignmentNonComplianceMessageArgs]] = None,
            not_scopes: Optional[Sequence[str]] = None,
            overrides: Optional[Sequence[ResourcePolicyAssignmentOverrideArgs]] = None,
            parameters: Optional[str] = None,
            policy_definition_id: Optional[str] = None,
            resource_id: Optional[str] = None,
            resource_selectors: Optional[Sequence[ResourcePolicyAssignmentResourceSelectorArgs]] = None) -> ResourcePolicyAssignment
    func GetResourcePolicyAssignment(ctx *Context, name string, id IDInput, state *ResourcePolicyAssignmentState, opts ...ResourceOption) (*ResourcePolicyAssignment, error)
    public static ResourcePolicyAssignment Get(string name, Input<string> id, ResourcePolicyAssignmentState? state, CustomResourceOptions? opts = null)
    public static ResourcePolicyAssignment get(String name, Output<String> id, ResourcePolicyAssignmentState 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:
    Description string

    A description which should be used for this Policy Assignment.

    DisplayName string

    The Display Name for this Policy Assignment.

    Enforce bool

    Specifies if this Policy should be enforced or not? Defaults to true.

    Identity ResourcePolicyAssignmentIdentity

    An identity block as defined below.

    Note: The location field must also be specified when identity is specified.

    Location string

    The Azure Region where the Policy Assignment should exist. Changing this forces a new Policy Assignment to be created.

    Metadata string

    A JSON mapping of any Metadata for this Policy.

    Name string

    The name which should be used for this Policy Assignment. Changing this forces a new Resource Policy Assignment to be created. Cannot exceed 64 characters in length.

    NonComplianceMessages List<ResourcePolicyAssignmentNonComplianceMessage>

    One or more non_compliance_message blocks as defined below.

    NotScopes List<string>

    Specifies a list of Resource Scopes (for example a Subscription, or a Resource Group) within this Management Group which are excluded from this Policy.

    Overrides List<ResourcePolicyAssignmentOverride>

    One or more overrides blocks as defined below. More detail about overrides and resource_selectors see policy assignment structure

    Parameters string

    A JSON mapping of any Parameters for this Policy.

    PolicyDefinitionId string

    The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.

    ResourceId string

    The ID of the Resource (or Resource Scope) where this should be applied. Changing this forces a new Resource Policy Assignment to be created.

    To create a Policy Assignment at a Management Group use the azure.management.GroupPolicyAssignment resource, for a Resource Group use the azure.core.ResourceGroupPolicyAssignment and for a Subscription use the azure.core.SubscriptionPolicyAssignment resource.

    ResourceSelectors List<ResourcePolicyAssignmentResourceSelector>

    One or more resource_selectors blocks as defined below to filter polices by resource properties.

    Description string

    A description which should be used for this Policy Assignment.

    DisplayName string

    The Display Name for this Policy Assignment.

    Enforce bool

    Specifies if this Policy should be enforced or not? Defaults to true.

    Identity ResourcePolicyAssignmentIdentityArgs

    An identity block as defined below.

    Note: The location field must also be specified when identity is specified.

    Location string

    The Azure Region where the Policy Assignment should exist. Changing this forces a new Policy Assignment to be created.

    Metadata string

    A JSON mapping of any Metadata for this Policy.

    Name string

    The name which should be used for this Policy Assignment. Changing this forces a new Resource Policy Assignment to be created. Cannot exceed 64 characters in length.

    NonComplianceMessages []ResourcePolicyAssignmentNonComplianceMessageArgs

    One or more non_compliance_message blocks as defined below.

    NotScopes []string

    Specifies a list of Resource Scopes (for example a Subscription, or a Resource Group) within this Management Group which are excluded from this Policy.

    Overrides []ResourcePolicyAssignmentOverrideArgs

    One or more overrides blocks as defined below. More detail about overrides and resource_selectors see policy assignment structure

    Parameters string

    A JSON mapping of any Parameters for this Policy.

    PolicyDefinitionId string

    The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.

    ResourceId string

    The ID of the Resource (or Resource Scope) where this should be applied. Changing this forces a new Resource Policy Assignment to be created.

    To create a Policy Assignment at a Management Group use the azure.management.GroupPolicyAssignment resource, for a Resource Group use the azure.core.ResourceGroupPolicyAssignment and for a Subscription use the azure.core.SubscriptionPolicyAssignment resource.

    ResourceSelectors []ResourcePolicyAssignmentResourceSelectorArgs

    One or more resource_selectors blocks as defined below to filter polices by resource properties.

    description String

    A description which should be used for this Policy Assignment.

    displayName String

    The Display Name for this Policy Assignment.

    enforce Boolean

    Specifies if this Policy should be enforced or not? Defaults to true.

    identity ResourcePolicyAssignmentIdentity

    An identity block as defined below.

    Note: The location field must also be specified when identity is specified.

    location String

    The Azure Region where the Policy Assignment should exist. Changing this forces a new Policy Assignment to be created.

    metadata String

    A JSON mapping of any Metadata for this Policy.

    name String

    The name which should be used for this Policy Assignment. Changing this forces a new Resource Policy Assignment to be created. Cannot exceed 64 characters in length.

    nonComplianceMessages List<ResourcePolicyAssignmentNonComplianceMessage>

    One or more non_compliance_message blocks as defined below.

    notScopes List<String>

    Specifies a list of Resource Scopes (for example a Subscription, or a Resource Group) within this Management Group which are excluded from this Policy.

    overrides List<ResourcePolicyAssignmentOverride>

    One or more overrides blocks as defined below. More detail about overrides and resource_selectors see policy assignment structure

    parameters String

    A JSON mapping of any Parameters for this Policy.

    policyDefinitionId String

    The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.

    resourceId String

    The ID of the Resource (or Resource Scope) where this should be applied. Changing this forces a new Resource Policy Assignment to be created.

    To create a Policy Assignment at a Management Group use the azure.management.GroupPolicyAssignment resource, for a Resource Group use the azure.core.ResourceGroupPolicyAssignment and for a Subscription use the azure.core.SubscriptionPolicyAssignment resource.

    resourceSelectors List<ResourcePolicyAssignmentResourceSelector>

    One or more resource_selectors blocks as defined below to filter polices by resource properties.

    description string

    A description which should be used for this Policy Assignment.

    displayName string

    The Display Name for this Policy Assignment.

    enforce boolean

    Specifies if this Policy should be enforced or not? Defaults to true.

    identity ResourcePolicyAssignmentIdentity

    An identity block as defined below.

    Note: The location field must also be specified when identity is specified.

    location string

    The Azure Region where the Policy Assignment should exist. Changing this forces a new Policy Assignment to be created.

    metadata string

    A JSON mapping of any Metadata for this Policy.

    name string

    The name which should be used for this Policy Assignment. Changing this forces a new Resource Policy Assignment to be created. Cannot exceed 64 characters in length.

    nonComplianceMessages ResourcePolicyAssignmentNonComplianceMessage[]

    One or more non_compliance_message blocks as defined below.

    notScopes string[]

    Specifies a list of Resource Scopes (for example a Subscription, or a Resource Group) within this Management Group which are excluded from this Policy.

    overrides ResourcePolicyAssignmentOverride[]

    One or more overrides blocks as defined below. More detail about overrides and resource_selectors see policy assignment structure

    parameters string

    A JSON mapping of any Parameters for this Policy.

    policyDefinitionId string

    The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.

    resourceId string

    The ID of the Resource (or Resource Scope) where this should be applied. Changing this forces a new Resource Policy Assignment to be created.

    To create a Policy Assignment at a Management Group use the azure.management.GroupPolicyAssignment resource, for a Resource Group use the azure.core.ResourceGroupPolicyAssignment and for a Subscription use the azure.core.SubscriptionPolicyAssignment resource.

    resourceSelectors ResourcePolicyAssignmentResourceSelector[]

    One or more resource_selectors blocks as defined below to filter polices by resource properties.

    description str

    A description which should be used for this Policy Assignment.

    display_name str

    The Display Name for this Policy Assignment.

    enforce bool

    Specifies if this Policy should be enforced or not? Defaults to true.

    identity ResourcePolicyAssignmentIdentityArgs

    An identity block as defined below.

    Note: The location field must also be specified when identity is specified.

    location str

    The Azure Region where the Policy Assignment should exist. Changing this forces a new Policy Assignment to be created.

    metadata str

    A JSON mapping of any Metadata for this Policy.

    name str

    The name which should be used for this Policy Assignment. Changing this forces a new Resource Policy Assignment to be created. Cannot exceed 64 characters in length.

    non_compliance_messages Sequence[ResourcePolicyAssignmentNonComplianceMessageArgs]

    One or more non_compliance_message blocks as defined below.

    not_scopes Sequence[str]

    Specifies a list of Resource Scopes (for example a Subscription, or a Resource Group) within this Management Group which are excluded from this Policy.

    overrides Sequence[ResourcePolicyAssignmentOverrideArgs]

    One or more overrides blocks as defined below. More detail about overrides and resource_selectors see policy assignment structure

    parameters str

    A JSON mapping of any Parameters for this Policy.

    policy_definition_id str

    The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.

    resource_id str

    The ID of the Resource (or Resource Scope) where this should be applied. Changing this forces a new Resource Policy Assignment to be created.

    To create a Policy Assignment at a Management Group use the azure.management.GroupPolicyAssignment resource, for a Resource Group use the azure.core.ResourceGroupPolicyAssignment and for a Subscription use the azure.core.SubscriptionPolicyAssignment resource.

    resource_selectors Sequence[ResourcePolicyAssignmentResourceSelectorArgs]

    One or more resource_selectors blocks as defined below to filter polices by resource properties.

    description String

    A description which should be used for this Policy Assignment.

    displayName String

    The Display Name for this Policy Assignment.

    enforce Boolean

    Specifies if this Policy should be enforced or not? Defaults to true.

    identity Property Map

    An identity block as defined below.

    Note: The location field must also be specified when identity is specified.

    location String

    The Azure Region where the Policy Assignment should exist. Changing this forces a new Policy Assignment to be created.

    metadata String

    A JSON mapping of any Metadata for this Policy.

    name String

    The name which should be used for this Policy Assignment. Changing this forces a new Resource Policy Assignment to be created. Cannot exceed 64 characters in length.

    nonComplianceMessages List<Property Map>

    One or more non_compliance_message blocks as defined below.

    notScopes List<String>

    Specifies a list of Resource Scopes (for example a Subscription, or a Resource Group) within this Management Group which are excluded from this Policy.

    overrides List<Property Map>

    One or more overrides blocks as defined below. More detail about overrides and resource_selectors see policy assignment structure

    parameters String

    A JSON mapping of any Parameters for this Policy.

    policyDefinitionId String

    The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.

    resourceId String

    The ID of the Resource (or Resource Scope) where this should be applied. Changing this forces a new Resource Policy Assignment to be created.

    To create a Policy Assignment at a Management Group use the azure.management.GroupPolicyAssignment resource, for a Resource Group use the azure.core.ResourceGroupPolicyAssignment and for a Subscription use the azure.core.SubscriptionPolicyAssignment resource.

    resourceSelectors List<Property Map>

    One or more resource_selectors blocks as defined below to filter polices by resource properties.

    Supporting Types

    ResourcePolicyAssignmentIdentity, ResourcePolicyAssignmentIdentityArgs

    Type string

    The Type of Managed Identity which should be added to this Policy Definition. Possible values are SystemAssigned and UserAssigned.

    IdentityIds List<string>

    A list of User Managed Identity IDs which should be assigned to the Policy Definition.

    NOTE: This is required when type is set to UserAssigned.

    PrincipalId string

    The Principal ID of the Policy Assignment for this Resource.

    TenantId string

    The Tenant ID of the Policy Assignment for this Resource.

    Type string

    The Type of Managed Identity which should be added to this Policy Definition. Possible values are SystemAssigned and UserAssigned.

    IdentityIds []string

    A list of User Managed Identity IDs which should be assigned to the Policy Definition.

    NOTE: This is required when type is set to UserAssigned.

    PrincipalId string

    The Principal ID of the Policy Assignment for this Resource.

    TenantId string

    The Tenant ID of the Policy Assignment for this Resource.

    type String

    The Type of Managed Identity which should be added to this Policy Definition. Possible values are SystemAssigned and UserAssigned.

    identityIds List<String>

    A list of User Managed Identity IDs which should be assigned to the Policy Definition.

    NOTE: This is required when type is set to UserAssigned.

    principalId String

    The Principal ID of the Policy Assignment for this Resource.

    tenantId String

    The Tenant ID of the Policy Assignment for this Resource.

    type string

    The Type of Managed Identity which should be added to this Policy Definition. Possible values are SystemAssigned and UserAssigned.

    identityIds string[]

    A list of User Managed Identity IDs which should be assigned to the Policy Definition.

    NOTE: This is required when type is set to UserAssigned.

    principalId string

    The Principal ID of the Policy Assignment for this Resource.

    tenantId string

    The Tenant ID of the Policy Assignment for this Resource.

    type str

    The Type of Managed Identity which should be added to this Policy Definition. Possible values are SystemAssigned and UserAssigned.

    identity_ids Sequence[str]

    A list of User Managed Identity IDs which should be assigned to the Policy Definition.

    NOTE: This is required when type is set to UserAssigned.

    principal_id str

    The Principal ID of the Policy Assignment for this Resource.

    tenant_id str

    The Tenant ID of the Policy Assignment for this Resource.

    type String

    The Type of Managed Identity which should be added to this Policy Definition. Possible values are SystemAssigned and UserAssigned.

    identityIds List<String>

    A list of User Managed Identity IDs which should be assigned to the Policy Definition.

    NOTE: This is required when type is set to UserAssigned.

    principalId String

    The Principal ID of the Policy Assignment for this Resource.

    tenantId String

    The Tenant ID of the Policy Assignment for this Resource.

    ResourcePolicyAssignmentNonComplianceMessage, ResourcePolicyAssignmentNonComplianceMessageArgs

    Content string

    The non-compliance message text. When assigning policy sets (initiatives), unless policy_definition_reference_id is specified then this message will be the default for all policies.

    PolicyDefinitionReferenceId string

    When assigning policy sets (initiatives), this is the ID of the policy definition that the non-compliance message applies to.

    Content string

    The non-compliance message text. When assigning policy sets (initiatives), unless policy_definition_reference_id is specified then this message will be the default for all policies.

    PolicyDefinitionReferenceId string

    When assigning policy sets (initiatives), this is the ID of the policy definition that the non-compliance message applies to.

    content String

    The non-compliance message text. When assigning policy sets (initiatives), unless policy_definition_reference_id is specified then this message will be the default for all policies.

    policyDefinitionReferenceId String

    When assigning policy sets (initiatives), this is the ID of the policy definition that the non-compliance message applies to.

    content string

    The non-compliance message text. When assigning policy sets (initiatives), unless policy_definition_reference_id is specified then this message will be the default for all policies.

    policyDefinitionReferenceId string

    When assigning policy sets (initiatives), this is the ID of the policy definition that the non-compliance message applies to.

    content str

    The non-compliance message text. When assigning policy sets (initiatives), unless policy_definition_reference_id is specified then this message will be the default for all policies.

    policy_definition_reference_id str

    When assigning policy sets (initiatives), this is the ID of the policy definition that the non-compliance message applies to.

    content String

    The non-compliance message text. When assigning policy sets (initiatives), unless policy_definition_reference_id is specified then this message will be the default for all policies.

    policyDefinitionReferenceId String

    When assigning policy sets (initiatives), this is the ID of the policy definition that the non-compliance message applies to.

    ResourcePolicyAssignmentOverride, ResourcePolicyAssignmentOverrideArgs

    Value string

    Specifies the value to override the policy property. Possible values for policyEffect override listed policy effects.

    Selectors List<ResourcePolicyAssignmentOverrideSelector>

    One or more override_selector as defined below.

    Value string

    Specifies the value to override the policy property. Possible values for policyEffect override listed policy effects.

    Selectors []ResourcePolicyAssignmentOverrideSelector

    One or more override_selector as defined below.

    value String

    Specifies the value to override the policy property. Possible values for policyEffect override listed policy effects.

    selectors List<ResourcePolicyAssignmentOverrideSelector>

    One or more override_selector as defined below.

    value string

    Specifies the value to override the policy property. Possible values for policyEffect override listed policy effects.

    selectors ResourcePolicyAssignmentOverrideSelector[]

    One or more override_selector as defined below.

    value str

    Specifies the value to override the policy property. Possible values for policyEffect override listed policy effects.

    selectors Sequence[ResourcePolicyAssignmentOverrideSelector]

    One or more override_selector as defined below.

    value String

    Specifies the value to override the policy property. Possible values for policyEffect override listed policy effects.

    selectors List<Property Map>

    One or more override_selector as defined below.

    ResourcePolicyAssignmentOverrideSelector, ResourcePolicyAssignmentOverrideSelectorArgs

    Ins List<string>

    Specify the list of policy reference id values to filter in. Cannot be used with not_in.

    Kind string

    Specifies which characteristic will narrow down the set of evaluated resources. Possible values are resourceLocation, resourceType and resourceWithoutLocation.

    NotIns List<string>

    Specify the list of policy reference id values to filter out. Cannot be used with in.

    Ins []string

    Specify the list of policy reference id values to filter in. Cannot be used with not_in.

    Kind string

    Specifies which characteristic will narrow down the set of evaluated resources. Possible values are resourceLocation, resourceType and resourceWithoutLocation.

    NotIns []string

    Specify the list of policy reference id values to filter out. Cannot be used with in.

    ins List<String>

    Specify the list of policy reference id values to filter in. Cannot be used with not_in.

    kind String

    Specifies which characteristic will narrow down the set of evaluated resources. Possible values are resourceLocation, resourceType and resourceWithoutLocation.

    notIns List<String>

    Specify the list of policy reference id values to filter out. Cannot be used with in.

    ins string[]

    Specify the list of policy reference id values to filter in. Cannot be used with not_in.

    kind string

    Specifies which characteristic will narrow down the set of evaluated resources. Possible values are resourceLocation, resourceType and resourceWithoutLocation.

    notIns string[]

    Specify the list of policy reference id values to filter out. Cannot be used with in.

    ins Sequence[str]

    Specify the list of policy reference id values to filter in. Cannot be used with not_in.

    kind str

    Specifies which characteristic will narrow down the set of evaluated resources. Possible values are resourceLocation, resourceType and resourceWithoutLocation.

    not_ins Sequence[str]

    Specify the list of policy reference id values to filter out. Cannot be used with in.

    ins List<String>

    Specify the list of policy reference id values to filter in. Cannot be used with not_in.

    kind String

    Specifies which characteristic will narrow down the set of evaluated resources. Possible values are resourceLocation, resourceType and resourceWithoutLocation.

    notIns List<String>

    Specify the list of policy reference id values to filter out. Cannot be used with in.

    ResourcePolicyAssignmentResourceSelector, ResourcePolicyAssignmentResourceSelectorArgs

    Selectors List<ResourcePolicyAssignmentResourceSelectorSelector>

    One or more resource_selector block as defined below.

    Name string

    Specifies a name for the resource selector.

    Selectors []ResourcePolicyAssignmentResourceSelectorSelector

    One or more resource_selector block as defined below.

    Name string

    Specifies a name for the resource selector.

    selectors List<ResourcePolicyAssignmentResourceSelectorSelector>

    One or more resource_selector block as defined below.

    name String

    Specifies a name for the resource selector.

    selectors ResourcePolicyAssignmentResourceSelectorSelector[]

    One or more resource_selector block as defined below.

    name string

    Specifies a name for the resource selector.

    selectors Sequence[ResourcePolicyAssignmentResourceSelectorSelector]

    One or more resource_selector block as defined below.

    name str

    Specifies a name for the resource selector.

    selectors List<Property Map>

    One or more resource_selector block as defined below.

    name String

    Specifies a name for the resource selector.

    ResourcePolicyAssignmentResourceSelectorSelector, ResourcePolicyAssignmentResourceSelectorSelectorArgs

    Kind string

    Specifies which characteristic will narrow down the set of evaluated resources. Possible values are resourceLocation, resourceType and resourceWithoutLocation.

    Ins List<string>

    Specify the list of policy reference id values to filter in. Cannot be used with not_in.

    NotIns List<string>

    Specify the list of policy reference id values to filter out. Cannot be used with in.

    Kind string

    Specifies which characteristic will narrow down the set of evaluated resources. Possible values are resourceLocation, resourceType and resourceWithoutLocation.

    Ins []string

    Specify the list of policy reference id values to filter in. Cannot be used with not_in.

    NotIns []string

    Specify the list of policy reference id values to filter out. Cannot be used with in.

    kind String

    Specifies which characteristic will narrow down the set of evaluated resources. Possible values are resourceLocation, resourceType and resourceWithoutLocation.

    ins List<String>

    Specify the list of policy reference id values to filter in. Cannot be used with not_in.

    notIns List<String>

    Specify the list of policy reference id values to filter out. Cannot be used with in.

    kind string

    Specifies which characteristic will narrow down the set of evaluated resources. Possible values are resourceLocation, resourceType and resourceWithoutLocation.

    ins string[]

    Specify the list of policy reference id values to filter in. Cannot be used with not_in.

    notIns string[]

    Specify the list of policy reference id values to filter out. Cannot be used with in.

    kind str

    Specifies which characteristic will narrow down the set of evaluated resources. Possible values are resourceLocation, resourceType and resourceWithoutLocation.

    ins Sequence[str]

    Specify the list of policy reference id values to filter in. Cannot be used with not_in.

    not_ins Sequence[str]

    Specify the list of policy reference id values to filter out. Cannot be used with in.

    kind String

    Specifies which characteristic will narrow down the set of evaluated resources. Possible values are resourceLocation, resourceType and resourceWithoutLocation.

    ins List<String>

    Specify the list of policy reference id values to filter in. Cannot be used with not_in.

    notIns List<String>

    Specify the list of policy reference id values to filter out. Cannot be used with in.

    Import

    Resource Policy Assignments can be imported using the resource id, e.g.

     $ pulumi import azure:core/resourcePolicyAssignment:ResourcePolicyAssignment example "{resource}/providers/Microsoft.Authorization/policyAssignments/assignment1"
    

    where {resource} is a Resource ID in the form /subscriptions/00000000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/virtualNetworks/network1.

    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 v5.49.0 published on Tuesday, Aug 29, 2023 by Pulumi