Class Remediation
Manages an Azure Policy Remediation at the specified Scope.
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
{
Location = "West Europe",
});
var exampleDefinition = new Azure.Policy.Definition("exampleDefinition", new Azure.Policy.DefinitionArgs
{
PolicyType = "Custom",
Mode = "All",
DisplayName = "my-policy-definition",
PolicyRule = @" {
""if"": {
""not"": {
""field"": ""location"",
""in"": ""[parameters('allowedLocations')]""
}
},
""then"": {
""effect"": ""audit""
}
}
",
Parameters = @" {
""allowedLocations"": {
""type"": ""Array"",
""metadata"": {
""description"": ""The list of allowed locations for resources."",
""displayName"": ""Allowed locations"",
""strongType"": ""location""
}
}
}
",
});
var exampleAssignment = new Azure.Policy.Assignment("exampleAssignment", new Azure.Policy.AssignmentArgs
{
Scope = exampleResourceGroup.Id,
PolicyDefinitionId = exampleDefinition.Id,
Description = "Policy Assignment created via an Acceptance Test",
DisplayName = "My Example Policy Assignment",
Parameters = @"{
""allowedLocations"": {
""value"": [ ""West Europe"" ]
}
}
",
});
var exampleRemediation = new Azure.Policy.Remediation("exampleRemediation", new Azure.Policy.RemediationArgs
{
Scope = exampleAssignment.Scope,
PolicyAssignmentId = exampleAssignment.Id,
LocationFilters =
{
"West Europe",
},
});
}
}
Inherited Members
Namespace: Pulumi.Azure.Policy
Assembly: Pulumi.Azure.dll
Syntax
public class Remediation : CustomResource
Constructors
View SourceRemediation(String, RemediationArgs, CustomResourceOptions)
Create a Remediation resource with the given unique name, arguments, and options.
Declaration
public Remediation(string name, RemediationArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| RemediationArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceLocationFilters
A list of the resource locations that will be remediated.
Declaration
public Output<ImmutableArray<string>> LocationFilters { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
Name
The name of the Policy Remediation. Changing this forces a new resource to be created.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
PolicyAssignmentId
The resource ID of the policy assignment that should be remediated.
Declaration
public Output<string> PolicyAssignmentId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
PolicyDefinitionReferenceId
The policy definition reference ID of the individual definition that should be remediated. Required when the policy assignment being remediated assigns a policy set definition.
Declaration
public Output<string> PolicyDefinitionReferenceId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Scope
The Scope at which the Policy Remediation should be applied. Changing this forces a new resource to be created. A scope must be a Resource ID out of one of the following list:
Declaration
public Output<string> Scope { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, RemediationState, CustomResourceOptions)
Get an existing Remediation resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static Remediation Get(string name, Input<string> id, RemediationState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| RemediationState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| Remediation |