Skip to content

AuditIfNotExists

SYNOPSIS

The auditIfNotExists effect: audits a resource that has no related resource in the compliant state. Use it instead of Effect.

SYNTAX

AuditIfNotExists [[-Body] <ScriptBlock>] [[-Type] <Object>] [-Name <Object>] [-ResourceGroupName <Object>] [-ExistenceScope <String>] [-EvaluationDelay <Object>] [-Effect <Object>] [<CommonParameters>
]

USED IN

Policy

EXAMPLES

Example 1

AuditIfNotExists 'Microsoft.Compute/virtualMachines/extensions' {
    Require 'The antimalware extension is installed' {
        Field publisher | Must -Be 'Microsoft.Azure.Security'
        Field type | Must -Be 'IaaSAntimalware'
    }
}

PARAMETERS

-Body

Require blocks that describe the related resource's compliant state.

Type: ScriptBlock
Required: false
Position: 2
Accept pipeline input: false

-Type

The related resource type, e.g. 'Microsoft.Compute/virtualMachines/extensions'. An object, so a block written without a type can be told apart from the type (BYL1038).

Type: Object
Required: false
Position: 1
Accept pipeline input: false

-Name

The related resource's name: a literal, Param or Arm.

Type: Object
Required: false
Position: named
Accept pipeline input: false

-ResourceGroupName

The related resource's resource group: a literal, Param or Arm.

Type: Object
Required: false
Position: named
Accept pipeline input: false

-ExistenceScope

Where to look for related resources: ResourceGroup (Azure's default) or Subscription.

Type: String
Required: false
Position: named
Accept pipeline input: false

-EvaluationDelay

When to evaluate after a change: AfterProvisioning, AfterProvisioningSuccess, AfterProvisioningFailure, or an ISO 8601 duration up to 360 minutes, e.g. PT30M. Or a String parameter, (Param EvaluationDelay), or an Arm expression.

Type: Object
Required: false
Position: named
Accept pipeline input: false

-Effect

The effect as a parameter, (Param Effect). Without it, the effect is AuditIfNotExists.

Type: Object
Required: false
Position: named
Accept pipeline input: false