DeployIfNotExists¶
SYNOPSIS¶
The deployIfNotExists effect: deploys a template when a resource has no related resource in the compliant state. Use it instead of Effect.
SYNTAX¶
DeployIfNotExists [[-Body] <ScriptBlock>] [[-Type] <Object>] [-Role <String[]>] [-Name <Object>] [-ResourceGroupName <Object>] [-ExistenceScope <String>] [-EvaluationDelay <Object>] [-Effect <Object>]
[<CommonParameters>]
USED IN¶
Policy
EXAMPLES¶
Example 1¶
DeployIfNotExists 'Microsoft.Compute/virtualMachines/extensions' -Role 'Virtual Machine Contributor' {
Require 'The antimalware extension is installed' {
Field publisher | Must -Be 'Microsoft.Azure.Security'
}
Deployment -TemplateFile ./templates/antimalware.json -Parameters @{
vmName = Arm "[field('name')]"
}
}
PARAMETERS¶
-Body¶
Require blocks that describe the related resource's compliant state, and the Deployment.
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
-Role¶
Roles the assignment's managed identity needs to deploy the template: built-in role names, GUIDs or full role definition IDs (ADR-0022).
Type: String[]
Required: false
Position: named
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 DeployIfNotExists.
Type: Object
Required: false
Position: named
Accept pipeline input: false