Edit

New-AzImageBuilderTemplateValidatorObject

Create an in-memory object for ImageTemplateValidator.

Syntax

PowerShellValidator (Default)

New-AzImageBuilderTemplateValidatorObject
    [-PowerShellValidator]
    [-Inline <String[]>]
    [-RunAsSystem <Boolean>]
    [-RunElevated <Boolean>]
    [-ScriptUri <String>]
    [-Sha256Checksum <String>]
    [-ValidExitCode <Int32[]>]
    [-Name <String>]
    [<CommonParameters>]

ShellValidator

New-AzImageBuilderTemplateValidatorObject
    [-Inline <String[]>]
    [-ScriptUri <String>]
    [-Sha256Checksum <String>]
    [-Name <String>]
    [-ShellValidator]
    [<CommonParameters>]

Description

Create an in-memory object for ImageTemplateValidator.

Examples

Example 1: Create a PowerShell validator.

New-AzImageBuilderTemplateValidatorObject -PowerShellValidator -Name PowerShellValidator -ScriptUri "https://example.com/path/to/script.sh"
Name                Inline RunAsSystem RunElevated ScriptUri                             Sha256Checksum ValidExitCode
----                ------ ----------- ----------- ---------                             -------------- -------------
PowerShellValidator                                https://example.com/path/to/script.sh

This command creates a powershell validator.

Example 2: Create a Shell validator.

New-AzImageBuilderTemplateValidatorObject -ShellValidator -Name ShellValidator -ScriptUri "https://example.com/path/to/script.sh"
Name           Inline ScriptUri                             Sha256Checksum
----           ------ ---------                             --------------
ShellValidator        https://example.com/path/to/script.sh

This command creates a shell validator.

Parameters

-Inline

Array of PowerShell commands to execute.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Friendly Name to provide context on what this validation step does.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PowerShellValidator

Runs the specified PowerShell script during the validation phase (Windows). Corresponds to Packer powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

PowerShellValidator
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RunAsSystem

If specified, the PowerShell script will be run with elevated privileges using the Local System user. Can only be true when the runElevated field above is set to true.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

PowerShellValidator
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RunElevated

If specified, the PowerShell script will be run with elevated privileges.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

PowerShellValidator
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ScriptUri

URI of the PowerShell script to be run for validation. It can be a github link, Azure Storage URI, etc.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Sha256Checksum

SHA256 checksum of the power shell script provided in the scriptUri field above.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ShellValidator

Runs the specified shell script during the validation phase (Linux). Corresponds to Packer shell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ShellValidator
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ValidExitCode

Valid exit codes for the PowerShell script. [Default: 0].

Parameter properties

Type:

Int32[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

PowerShellValidator
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

ImageTemplatePowerShellValidator

ImageTemplateShellValidator