We recommend using Azure Native.
azure.core.SubscriptionPolicyAssignment
Explore with Pulumi AI
Manages a Subscription Policy Assignment.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var current = Azure.Core.GetSubscription.Invoke();
var exampleDefinition = new Azure.Policy.Definition("exampleDefinition", new()
{
PolicyType = "Custom",
Mode = "All",
DisplayName = "Allowed resource types",
PolicyRule = @" {
""if"": {
""not"": {
""field"": ""location"",
""equals"": ""westeurope""
}
},
""then"": {
""effect"": ""Deny""
}
}
",
});
var exampleSubscriptionPolicyAssignment = new Azure.Core.SubscriptionPolicyAssignment("exampleSubscriptionPolicyAssignment", new()
{
PolicyDefinitionId = exampleDefinition.Id,
SubscriptionId = current.Apply(getSubscriptionResult => getSubscriptionResult.Id),
});
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
"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 {
current, err := core.LookupSubscription(ctx, nil, 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("Allowed resource types"),
PolicyRule: pulumi.String(` {
"if": {
"not": {
"field": "location",
"equals": "westeurope"
}
},
"then": {
"effect": "Deny"
}
}
`),
})
if err != nil {
return err
}
_, err = core.NewSubscriptionPolicyAssignment(ctx, "exampleSubscriptionPolicyAssignment", &core.SubscriptionPolicyAssignmentArgs{
PolicyDefinitionId: exampleDefinition.ID(),
SubscriptionId: *pulumi.String(current.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.core.CoreFunctions;
import com.pulumi.azure.core.inputs.GetSubscriptionArgs;
import com.pulumi.azure.policy.Definition;
import com.pulumi.azure.policy.DefinitionArgs;
import com.pulumi.azure.core.SubscriptionPolicyAssignment;
import com.pulumi.azure.core.SubscriptionPolicyAssignmentArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var current = CoreFunctions.getSubscription();
var exampleDefinition = new Definition("exampleDefinition", DefinitionArgs.builder()
.policyType("Custom")
.mode("All")
.displayName("Allowed resource types")
.policyRule("""
{
"if": {
"not": {
"field": "location",
"equals": "westeurope"
}
},
"then": {
"effect": "Deny"
}
}
""")
.build());
var exampleSubscriptionPolicyAssignment = new SubscriptionPolicyAssignment("exampleSubscriptionPolicyAssignment", SubscriptionPolicyAssignmentArgs.builder()
.policyDefinitionId(exampleDefinition.id())
.subscriptionId(current.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
.build());
}
}
import pulumi
import pulumi_azure as azure
current = azure.core.get_subscription()
example_definition = azure.policy.Definition("exampleDefinition",
policy_type="Custom",
mode="All",
display_name="Allowed resource types",
policy_rule=""" {
"if": {
"not": {
"field": "location",
"equals": "westeurope"
}
},
"then": {
"effect": "Deny"
}
}
""")
example_subscription_policy_assignment = azure.core.SubscriptionPolicyAssignment("exampleSubscriptionPolicyAssignment",
policy_definition_id=example_definition.id,
subscription_id=current.id)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const current = azure.core.getSubscription({});
const exampleDefinition = new azure.policy.Definition("exampleDefinition", {
policyType: "Custom",
mode: "All",
displayName: "Allowed resource types",
policyRule: ` {
"if": {
"not": {
"field": "location",
"equals": "westeurope"
}
},
"then": {
"effect": "Deny"
}
}
`,
});
const exampleSubscriptionPolicyAssignment = new azure.core.SubscriptionPolicyAssignment("exampleSubscriptionPolicyAssignment", {
policyDefinitionId: exampleDefinition.id,
subscriptionId: current.then(current => current.id),
});
resources:
exampleDefinition:
type: azure:policy:Definition
properties:
policyType: Custom
mode: All
displayName: Allowed resource types
policyRule: |2
{
"if": {
"not": {
"field": "location",
"equals": "westeurope"
}
},
"then": {
"effect": "Deny"
}
}
exampleSubscriptionPolicyAssignment:
type: azure:core:SubscriptionPolicyAssignment
properties:
policyDefinitionId: ${exampleDefinition.id}
subscriptionId: ${current.id}
variables:
current:
fn::invoke:
Function: azure:core:getSubscription
Arguments: {}
Create SubscriptionPolicyAssignment Resource
new SubscriptionPolicyAssignment(name: string, args: SubscriptionPolicyAssignmentArgs, opts?: CustomResourceOptions);
@overload
def SubscriptionPolicyAssignment(resource_name: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
display_name: Optional[str] = None,
enforce: Optional[bool] = None,
identity: Optional[SubscriptionPolicyAssignmentIdentityArgs] = None,
location: Optional[str] = None,
metadata: Optional[str] = None,
name: Optional[str] = None,
non_compliance_messages: Optional[Sequence[SubscriptionPolicyAssignmentNonComplianceMessageArgs]] = None,
not_scopes: Optional[Sequence[str]] = None,
overrides: Optional[Sequence[SubscriptionPolicyAssignmentOverrideArgs]] = None,
parameters: Optional[str] = None,
policy_definition_id: Optional[str] = None,
resource_selectors: Optional[Sequence[SubscriptionPolicyAssignmentResourceSelectorArgs]] = None,
subscription_id: Optional[str] = None)
@overload
def SubscriptionPolicyAssignment(resource_name: str,
args: SubscriptionPolicyAssignmentArgs,
opts: Optional[ResourceOptions] = None)
func NewSubscriptionPolicyAssignment(ctx *Context, name string, args SubscriptionPolicyAssignmentArgs, opts ...ResourceOption) (*SubscriptionPolicyAssignment, error)
public SubscriptionPolicyAssignment(string name, SubscriptionPolicyAssignmentArgs args, CustomResourceOptions? opts = null)
public SubscriptionPolicyAssignment(String name, SubscriptionPolicyAssignmentArgs args)
public SubscriptionPolicyAssignment(String name, SubscriptionPolicyAssignmentArgs args, CustomResourceOptions options)
type: azure:core:SubscriptionPolicyAssignment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SubscriptionPolicyAssignmentArgs
- 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 SubscriptionPolicyAssignmentArgs
- 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 SubscriptionPolicyAssignmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SubscriptionPolicyAssignmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SubscriptionPolicyAssignmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
SubscriptionPolicyAssignment 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 SubscriptionPolicyAssignment resource accepts the following input properties:
- Policy
Definition stringId The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.
- Subscription
Id string The ID of the Subscription where this Policy Assignment should be created. Changing this forces a new Policy Assignment to be created.
- Description string
A description which should be used for this Policy Assignment.
- Display
Name string The Display Name for this Policy Assignment.
- Enforce bool
Specifies if this Policy should be enforced or not? Defaults to
true
.- Identity
Subscription
Policy Assignment Identity An
identity
block as defined below.Note: The
location
field must also be specified whenidentity
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 Policy Assignment to be created. Cannot exceed 64 characters in length.
- Non
Compliance List<SubscriptionMessages Policy Assignment Non Compliance Message> One or more
non_compliance_message
blocks as defined below.- Not
Scopes 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<Subscription
Policy Assignment Override> One or more
overrides
blocks as defined below. More detail aboutoverrides
andresource_selectors
see policy assignment structure- Parameters string
A JSON mapping of any Parameters for this Policy.
- Resource
Selectors List<SubscriptionPolicy Assignment Resource Selector> One or more
resource_selectors
blocks as defined below to filter polices by resource properties.
- Policy
Definition stringId The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.
- Subscription
Id string The ID of the Subscription where this Policy Assignment should be created. Changing this forces a new Policy Assignment to be created.
- Description string
A description which should be used for this Policy Assignment.
- Display
Name string The Display Name for this Policy Assignment.
- Enforce bool
Specifies if this Policy should be enforced or not? Defaults to
true
.- Identity
Subscription
Policy Assignment Identity Args An
identity
block as defined below.Note: The
location
field must also be specified whenidentity
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 Policy Assignment to be created. Cannot exceed 64 characters in length.
- Non
Compliance []SubscriptionMessages Policy Assignment Non Compliance Message Args One or more
non_compliance_message
blocks as defined below.- Not
Scopes []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
[]Subscription
Policy Assignment Override Args One or more
overrides
blocks as defined below. More detail aboutoverrides
andresource_selectors
see policy assignment structure- Parameters string
A JSON mapping of any Parameters for this Policy.
- Resource
Selectors []SubscriptionPolicy Assignment Resource Selector Args One or more
resource_selectors
blocks as defined below to filter polices by resource properties.
- policy
Definition StringId The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.
- subscription
Id String The ID of the Subscription where this Policy Assignment should be created. Changing this forces a new Policy Assignment to be created.
- description String
A description which should be used for this Policy Assignment.
- display
Name String The Display Name for this Policy Assignment.
- enforce Boolean
Specifies if this Policy should be enforced or not? Defaults to
true
.- identity
Subscription
Policy Assignment Identity An
identity
block as defined below.Note: The
location
field must also be specified whenidentity
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 Policy Assignment to be created. Cannot exceed 64 characters in length.
- non
Compliance List<SubscriptionMessages Policy Assignment Non Compliance Message> One or more
non_compliance_message
blocks as defined below.- not
Scopes 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<Subscription
Policy Assignment Override> One or more
overrides
blocks as defined below. More detail aboutoverrides
andresource_selectors
see policy assignment structure- parameters String
A JSON mapping of any Parameters for this Policy.
- resource
Selectors List<SubscriptionPolicy Assignment Resource Selector> One or more
resource_selectors
blocks as defined below to filter polices by resource properties.
- policy
Definition stringId The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.
- subscription
Id string The ID of the Subscription where this Policy Assignment should be created. Changing this forces a new Policy Assignment to be created.
- description string
A description which should be used for this Policy Assignment.
- display
Name string The Display Name for this Policy Assignment.
- enforce boolean
Specifies if this Policy should be enforced or not? Defaults to
true
.- identity
Subscription
Policy Assignment Identity An
identity
block as defined below.Note: The
location
field must also be specified whenidentity
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 Policy Assignment to be created. Cannot exceed 64 characters in length.
- non
Compliance SubscriptionMessages Policy Assignment Non Compliance Message[] One or more
non_compliance_message
blocks as defined below.- not
Scopes 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
Subscription
Policy Assignment Override[] One or more
overrides
blocks as defined below. More detail aboutoverrides
andresource_selectors
see policy assignment structure- parameters string
A JSON mapping of any Parameters for this Policy.
- resource
Selectors SubscriptionPolicy Assignment Resource Selector[] One or more
resource_selectors
blocks as defined below to filter polices by resource properties.
- policy_
definition_ strid The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.
- subscription_
id str The ID of the Subscription where this Policy Assignment should be created. Changing this forces a new Policy Assignment to be created.
- 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
Subscription
Policy Assignment Identity Args An
identity
block as defined below.Note: The
location
field must also be specified whenidentity
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 Policy Assignment to be created. Cannot exceed 64 characters in length.
- non_
compliance_ Sequence[Subscriptionmessages Policy Assignment Non Compliance Message Args] 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[Subscription
Policy Assignment Override Args] One or more
overrides
blocks as defined below. More detail aboutoverrides
andresource_selectors
see policy assignment structure- parameters str
A JSON mapping of any Parameters for this Policy.
- resource_
selectors Sequence[SubscriptionPolicy Assignment Resource Selector Args] One or more
resource_selectors
blocks as defined below to filter polices by resource properties.
- policy
Definition StringId The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.
- subscription
Id String The ID of the Subscription where this Policy Assignment should be created. Changing this forces a new Policy Assignment to be created.
- description String
A description which should be used for this Policy Assignment.
- display
Name 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 whenidentity
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 Policy Assignment to be created. Cannot exceed 64 characters in length.
- non
Compliance List<Property Map>Messages One or more
non_compliance_message
blocks as defined below.- not
Scopes 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 aboutoverrides
andresource_selectors
see policy assignment structure- parameters String
A JSON mapping of any Parameters for this Policy.
- resource
Selectors 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 SubscriptionPolicyAssignment 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 SubscriptionPolicyAssignment Resource
Get an existing SubscriptionPolicyAssignment 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?: SubscriptionPolicyAssignmentState, opts?: CustomResourceOptions): SubscriptionPolicyAssignment
@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[SubscriptionPolicyAssignmentIdentityArgs] = None,
location: Optional[str] = None,
metadata: Optional[str] = None,
name: Optional[str] = None,
non_compliance_messages: Optional[Sequence[SubscriptionPolicyAssignmentNonComplianceMessageArgs]] = None,
not_scopes: Optional[Sequence[str]] = None,
overrides: Optional[Sequence[SubscriptionPolicyAssignmentOverrideArgs]] = None,
parameters: Optional[str] = None,
policy_definition_id: Optional[str] = None,
resource_selectors: Optional[Sequence[SubscriptionPolicyAssignmentResourceSelectorArgs]] = None,
subscription_id: Optional[str] = None) -> SubscriptionPolicyAssignment
func GetSubscriptionPolicyAssignment(ctx *Context, name string, id IDInput, state *SubscriptionPolicyAssignmentState, opts ...ResourceOption) (*SubscriptionPolicyAssignment, error)
public static SubscriptionPolicyAssignment Get(string name, Input<string> id, SubscriptionPolicyAssignmentState? state, CustomResourceOptions? opts = null)
public static SubscriptionPolicyAssignment get(String name, Output<String> id, SubscriptionPolicyAssignmentState 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.
- Description string
A description which should be used for this Policy Assignment.
- Display
Name string The Display Name for this Policy Assignment.
- Enforce bool
Specifies if this Policy should be enforced or not? Defaults to
true
.- Identity
Subscription
Policy Assignment Identity An
identity
block as defined below.Note: The
location
field must also be specified whenidentity
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 Policy Assignment to be created. Cannot exceed 64 characters in length.
- Non
Compliance List<SubscriptionMessages Policy Assignment Non Compliance Message> One or more
non_compliance_message
blocks as defined below.- Not
Scopes 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<Subscription
Policy Assignment Override> One or more
overrides
blocks as defined below. More detail aboutoverrides
andresource_selectors
see policy assignment structure- Parameters string
A JSON mapping of any Parameters for this Policy.
- Policy
Definition stringId The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.
- Resource
Selectors List<SubscriptionPolicy Assignment Resource Selector> One or more
resource_selectors
blocks as defined below to filter polices by resource properties.- Subscription
Id string The ID of the Subscription where this Policy Assignment should be created. Changing this forces a new Policy Assignment to be created.
- Description string
A description which should be used for this Policy Assignment.
- Display
Name string The Display Name for this Policy Assignment.
- Enforce bool
Specifies if this Policy should be enforced or not? Defaults to
true
.- Identity
Subscription
Policy Assignment Identity Args An
identity
block as defined below.Note: The
location
field must also be specified whenidentity
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 Policy Assignment to be created. Cannot exceed 64 characters in length.
- Non
Compliance []SubscriptionMessages Policy Assignment Non Compliance Message Args One or more
non_compliance_message
blocks as defined below.- Not
Scopes []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
[]Subscription
Policy Assignment Override Args One or more
overrides
blocks as defined below. More detail aboutoverrides
andresource_selectors
see policy assignment structure- Parameters string
A JSON mapping of any Parameters for this Policy.
- Policy
Definition stringId The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.
- Resource
Selectors []SubscriptionPolicy Assignment Resource Selector Args One or more
resource_selectors
blocks as defined below to filter polices by resource properties.- Subscription
Id string The ID of the Subscription where this Policy Assignment should be created. Changing this forces a new Policy Assignment to be created.
- description String
A description which should be used for this Policy Assignment.
- display
Name String The Display Name for this Policy Assignment.
- enforce Boolean
Specifies if this Policy should be enforced or not? Defaults to
true
.- identity
Subscription
Policy Assignment Identity An
identity
block as defined below.Note: The
location
field must also be specified whenidentity
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 Policy Assignment to be created. Cannot exceed 64 characters in length.
- non
Compliance List<SubscriptionMessages Policy Assignment Non Compliance Message> One or more
non_compliance_message
blocks as defined below.- not
Scopes 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<Subscription
Policy Assignment Override> One or more
overrides
blocks as defined below. More detail aboutoverrides
andresource_selectors
see policy assignment structure- parameters String
A JSON mapping of any Parameters for this Policy.
- policy
Definition StringId The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.
- resource
Selectors List<SubscriptionPolicy Assignment Resource Selector> One or more
resource_selectors
blocks as defined below to filter polices by resource properties.- subscription
Id String The ID of the Subscription where this Policy Assignment should be created. Changing this forces a new Policy Assignment to be created.
- description string
A description which should be used for this Policy Assignment.
- display
Name string The Display Name for this Policy Assignment.
- enforce boolean
Specifies if this Policy should be enforced or not? Defaults to
true
.- identity
Subscription
Policy Assignment Identity An
identity
block as defined below.Note: The
location
field must also be specified whenidentity
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 Policy Assignment to be created. Cannot exceed 64 characters in length.
- non
Compliance SubscriptionMessages Policy Assignment Non Compliance Message[] One or more
non_compliance_message
blocks as defined below.- not
Scopes 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
Subscription
Policy Assignment Override[] One or more
overrides
blocks as defined below. More detail aboutoverrides
andresource_selectors
see policy assignment structure- parameters string
A JSON mapping of any Parameters for this Policy.
- policy
Definition stringId The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.
- resource
Selectors SubscriptionPolicy Assignment Resource Selector[] One or more
resource_selectors
blocks as defined below to filter polices by resource properties.- subscription
Id string The ID of the Subscription where this Policy Assignment should be created. Changing this forces a new Policy Assignment to be created.
- 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
Subscription
Policy Assignment Identity Args An
identity
block as defined below.Note: The
location
field must also be specified whenidentity
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 Policy Assignment to be created. Cannot exceed 64 characters in length.
- non_
compliance_ Sequence[Subscriptionmessages Policy Assignment Non Compliance Message Args] 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[Subscription
Policy Assignment Override Args] One or more
overrides
blocks as defined below. More detail aboutoverrides
andresource_selectors
see policy assignment structure- parameters str
A JSON mapping of any Parameters for this Policy.
- policy_
definition_ strid The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.
- resource_
selectors Sequence[SubscriptionPolicy Assignment Resource Selector Args] One or more
resource_selectors
blocks as defined below to filter polices by resource properties.- subscription_
id str The ID of the Subscription where this Policy Assignment should be created. Changing this forces a new Policy Assignment to be created.
- description String
A description which should be used for this Policy Assignment.
- display
Name 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 whenidentity
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 Policy Assignment to be created. Cannot exceed 64 characters in length.
- non
Compliance List<Property Map>Messages One or more
non_compliance_message
blocks as defined below.- not
Scopes 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 aboutoverrides
andresource_selectors
see policy assignment structure- parameters String
A JSON mapping of any Parameters for this Policy.
- policy
Definition StringId The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created.
- resource
Selectors List<Property Map> One or more
resource_selectors
blocks as defined below to filter polices by resource properties.- subscription
Id String The ID of the Subscription where this Policy Assignment should be created. Changing this forces a new Policy Assignment to be created.
Supporting Types
SubscriptionPolicyAssignmentIdentity, SubscriptionPolicyAssignmentIdentityArgs
- Type string
The Type of Managed Identity which should be added to this Policy Definition. Possible values are
SystemAssigned
orUserAssigned
.- Identity
Ids 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 toUserAssigned
.- Principal
Id string The Principal ID of the Policy Assignment for this Subscription.
- Tenant
Id string The Tenant ID of the Policy Assignment for this Subscription.
- Type string
The Type of Managed Identity which should be added to this Policy Definition. Possible values are
SystemAssigned
orUserAssigned
.- Identity
Ids []string A list of User Managed Identity IDs which should be assigned to the Policy Definition.
NOTE: This is required when
type
is set toUserAssigned
.- Principal
Id string The Principal ID of the Policy Assignment for this Subscription.
- Tenant
Id string The Tenant ID of the Policy Assignment for this Subscription.
- type String
The Type of Managed Identity which should be added to this Policy Definition. Possible values are
SystemAssigned
orUserAssigned
.- identity
Ids 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 toUserAssigned
.- principal
Id String The Principal ID of the Policy Assignment for this Subscription.
- tenant
Id String The Tenant ID of the Policy Assignment for this Subscription.
- type string
The Type of Managed Identity which should be added to this Policy Definition. Possible values are
SystemAssigned
orUserAssigned
.- identity
Ids string[] A list of User Managed Identity IDs which should be assigned to the Policy Definition.
NOTE: This is required when
type
is set toUserAssigned
.- principal
Id string The Principal ID of the Policy Assignment for this Subscription.
- tenant
Id string The Tenant ID of the Policy Assignment for this Subscription.
- type str
The Type of Managed Identity which should be added to this Policy Definition. Possible values are
SystemAssigned
orUserAssigned
.- 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 toUserAssigned
.- principal_
id str The Principal ID of the Policy Assignment for this Subscription.
- tenant_
id str The Tenant ID of the Policy Assignment for this Subscription.
- type String
The Type of Managed Identity which should be added to this Policy Definition. Possible values are
SystemAssigned
orUserAssigned
.- identity
Ids 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 toUserAssigned
.- principal
Id String The Principal ID of the Policy Assignment for this Subscription.
- tenant
Id String The Tenant ID of the Policy Assignment for this Subscription.
SubscriptionPolicyAssignmentNonComplianceMessage, SubscriptionPolicyAssignmentNonComplianceMessageArgs
- 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.- Policy
Definition stringReference Id 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.- Policy
Definition stringReference Id 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.- policy
Definition StringReference Id 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.- policy
Definition stringReference Id 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_ strreference_ id 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.- policy
Definition StringReference Id When assigning policy sets (initiatives), this is the ID of the policy definition that the non-compliance message applies to.
SubscriptionPolicyAssignmentOverride, SubscriptionPolicyAssignmentOverrideArgs
- Value string
Specifies the value to override the policy property. Possible values for
policyEffect
override listed policy effects.- Selectors
List<Subscription
Policy Assignment Override Selector> 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
[]Subscription
Policy Assignment Override Selector 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<Subscription
Policy Assignment Override Selector> 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
Subscription
Policy Assignment Override Selector[] 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[Subscription
Policy Assignment Override Selector] 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.
SubscriptionPolicyAssignmentOverrideSelector, SubscriptionPolicyAssignmentOverrideSelectorArgs
- 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
andresourceWithoutLocation
.- Not
Ins 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
andresourceWithoutLocation
.- Not
Ins []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
andresourceWithoutLocation
.- not
Ins 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
andresourceWithoutLocation
.- not
Ins 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
andresourceWithoutLocation
.- 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
andresourceWithoutLocation
.- not
Ins List<String> Specify the list of policy reference id values to filter out. Cannot be used with
in
.
SubscriptionPolicyAssignmentResourceSelector, SubscriptionPolicyAssignmentResourceSelectorArgs
- Selectors
List<Subscription
Policy Assignment Resource Selector Selector> One or more
resource_selector
block as defined below.- Name string
Specifies a name for the resource selector.
- Selectors
[]Subscription
Policy Assignment Resource Selector Selector One or more
resource_selector
block as defined below.- Name string
Specifies a name for the resource selector.
- selectors
List<Subscription
Policy Assignment Resource Selector Selector> One or more
resource_selector
block as defined below.- name String
Specifies a name for the resource selector.
- selectors
Subscription
Policy Assignment Resource Selector Selector[] One or more
resource_selector
block as defined below.- name string
Specifies a name for the resource selector.
- selectors
Sequence[Subscription
Policy Assignment Resource Selector Selector] 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.
SubscriptionPolicyAssignmentResourceSelectorSelector, SubscriptionPolicyAssignmentResourceSelectorSelectorArgs
- Kind string
Specifies which characteristic will narrow down the set of evaluated resources. Possible values are
resourceLocation
,resourceType
andresourceWithoutLocation
.- Ins List<string>
Specify the list of policy reference id values to filter in. Cannot be used with
not_in
.- Not
Ins 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
andresourceWithoutLocation
.- Ins []string
Specify the list of policy reference id values to filter in. Cannot be used with
not_in
.- Not
Ins []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
andresourceWithoutLocation
.- ins List<String>
Specify the list of policy reference id values to filter in. Cannot be used with
not_in
.- not
Ins 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
andresourceWithoutLocation
.- ins string[]
Specify the list of policy reference id values to filter in. Cannot be used with
not_in
.- not
Ins 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
andresourceWithoutLocation
.- 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
andresourceWithoutLocation
.- ins List<String>
Specify the list of policy reference id values to filter in. Cannot be used with
not_in
.- not
Ins List<String> Specify the list of policy reference id values to filter out. Cannot be used with
in
.
Import
Subscription Policy Assignments can be imported using the resource id
, e.g.
$ pulumi import azure:core/subscriptionPolicyAssignment:SubscriptionPolicyAssignment example /subscriptions/00000000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/assignment1
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
azurerm
Terraform Provider.