ResourceGroupPolicyAssignmentArgs

data class ResourceGroupPolicyAssignmentArgs(val description: Output<String>? = null, val displayName: Output<String>? = null, val enforce: Output<Boolean>? = null, val identity: Output<ResourceGroupPolicyAssignmentIdentityArgs>? = null, val location: Output<String>? = null, val metadata: Output<String>? = null, val name: Output<String>? = null, val nonComplianceMessages: Output<List<ResourceGroupPolicyAssignmentNonComplianceMessageArgs>>? = null, val notScopes: Output<List<String>>? = null, val overrides: Output<List<ResourceGroupPolicyAssignmentOverrideArgs>>? = null, val parameters: Output<String>? = null, val policyDefinitionId: Output<String>? = null, val resourceGroupId: Output<String>? = null, val resourceSelectors: Output<List<ResourceGroupPolicyAssignmentResourceSelectorArgs>>? = null) : ConvertibleToJava<ResourceGroupPolicyAssignmentArgs>

Manages a Resource Group Policy Assignment.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.policy.Definition;
import com.pulumi.azure.policy.DefinitionArgs;
import com.pulumi.azure.core.ResourceGroupPolicyAssignment;
import com.pulumi.azure.core.ResourceGroupPolicyAssignmentArgs;
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) {
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.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 exampleResourceGroupPolicyAssignment = new ResourceGroupPolicyAssignment("exampleResourceGroupPolicyAssignment", ResourceGroupPolicyAssignmentArgs.builder()
.resourceGroupId(exampleResourceGroup.id())
.policyDefinitionId(exampleDefinition.id())
.parameters("""
{
"tagName": {
"value": "Business Unit"
},
"tagValue": {
"value": "BU"
}
}
""")
.build());
}
}

Import

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

$ pulumi import azure:core/resourceGroupPolicyAssignment:ResourceGroupPolicyAssignment example /subscriptions/00000000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Authorization/policyAssignments/assignment1

Constructors

Link copied to clipboard
fun ResourceGroupPolicyAssignmentArgs(description: Output<String>? = null, displayName: Output<String>? = null, enforce: Output<Boolean>? = null, identity: Output<ResourceGroupPolicyAssignmentIdentityArgs>? = null, location: Output<String>? = null, metadata: Output<String>? = null, name: Output<String>? = null, nonComplianceMessages: Output<List<ResourceGroupPolicyAssignmentNonComplianceMessageArgs>>? = null, notScopes: Output<List<String>>? = null, overrides: Output<List<ResourceGroupPolicyAssignmentOverrideArgs>>? = null, parameters: Output<String>? = null, policyDefinitionId: Output<String>? = null, resourceGroupId: Output<String>? = null, resourceSelectors: Output<List<ResourceGroupPolicyAssignmentResourceSelectorArgs>>? = null)

Functions

Link copied to clipboard
open override fun toJava(): ResourceGroupPolicyAssignmentArgs

Properties

Link copied to clipboard
val description: Output<String>? = null

A description which should be used for this Policy Assignment.

Link copied to clipboard
val displayName: Output<String>? = null

The Display Name for this Policy Assignment.

Link copied to clipboard
val enforce: Output<Boolean>? = null

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

Link copied to clipboard

An identity block as defined below.

Link copied to clipboard
val location: Output<String>? = null

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

Link copied to clipboard
val metadata: Output<String>? = null

A JSON mapping of any Metadata for this Policy.

Link copied to clipboard
val name: Output<String>? = null

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.

Link copied to clipboard

One or more non_compliance_message blocks as defined below.

Link copied to clipboard
val notScopes: Output<List<String>>? = null

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

Link copied to clipboard

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

Link copied to clipboard
val parameters: Output<String>? = null

A JSON mapping of any Parameters for this Policy.

Link copied to clipboard
val policyDefinitionId: Output<String>? = null

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

Link copied to clipboard
val resourceGroupId: Output<String>? = null

The ID of the Resource Group where this Policy Assignment should be created. Changing this forces a new Policy Assignment to be created.

Link copied to clipboard

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