New-AzImageBuilderTemplateCustomizerObject
Create an in-memory object for ImageTemplateCustomizer.
Syntax
FileCustomizer (Default)
New-AzImageBuilderTemplateCustomizerObject
[-FileCustomizer]
[-Destination <String>]
[-Sha256Checksum <String>]
[-SourceUri <String>]
[-Name <String>]
[<CommonParameters>]
ShellCustomizer
New-AzImageBuilderTemplateCustomizerObject
[-Sha256Checksum <String>]
[-Name <String>]
[-Inline <String[]>]
[-ScriptUri <String>]
[-ShellCustomizer]
[<CommonParameters>]
PowerShellCustomizer
New-AzImageBuilderTemplateCustomizerObject
[-Sha256Checksum <String>]
[-Name <String>]
[-PowerShellCustomizer]
[-Inline <String[]>]
[-RunAsSystem <Boolean>]
[-RunElevated <Boolean>]
[-ScriptUri <String>]
[-ValidExitCode <Int32[]>]
[<CommonParameters>]
RestartCustomizer
New-AzImageBuilderTemplateCustomizerObject
[-Name <String>]
[-RestartCustomizer]
[-RestartCheckCommand <String>]
[-RestartCommand <String>]
[-RestartTimeout <String>]
[<CommonParameters>]
WindowsUpdateCustomizer
New-AzImageBuilderTemplateCustomizerObject
[-Name <String>]
[-WindowsUpdateCustomizer]
[-Filter <String[]>]
[-SearchCriterion <String>]
[-UpdateLimit <Int32>]
[<CommonParameters>]
Description
Create an in-memory object for ImageTemplateCustomizer.
Examples
Example 1: Create a windows update customizer.
New-AzImageBuilderTemplateCustomizerObject -WindowsUpdateCustomizer -Name 'WindUpdate' -Filter ("BrowseOnly", "IsInstalled") -SearchCriterion "BrowseOnly=0 and IsInstalled=0" -UpdateLimit 100
Name Filter SearchCriterion UpdateLimit
---- ------ --------------- -----------
WindUpdate {BrowseOnly, IsInstalled} BrowseOnly=0 and IsInstalled=0 100
This command creates a windows update customizer.
Example 2: Create a file customizer.
New-AzImageBuilderTemplateCustomizerObject -FileCustomizer -Name 'filecus' -Destination 'c:\\buildArtifacts\\index.html' -SourceUri 'https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html'
Name Destination Sha256Checksum SourceUri
---- ----------- -------------- ---------
filecus c:\\buildArtifacts\\index.html https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html
This command creates a file customizer.
Example 3: Create a powershell customizer.
New-AzImageBuilderTemplateCustomizerObject -PowerShellCustomizer -Name settingUpMgmtAgtPath -RunElevated $false -Inline "mkdir c:\\buildActions", "echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt"
Name Inline RunAsSystem RunElevated ScriptUri Sha256Checksum ValidExitCode
---- ------ ----------- ----------- --------- -------------- -------------
settingUpMgmtAgtPath {mkdir c:\\buildActions, echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt} False
This command creates a powershell customizer.
Example 4: Create a restart customizer.
New-AzImageBuilderTemplateCustomizerObject -RestartCustomizer -Name 'restcus' -RestartCommand 'shutdown /f /r /t 0 /c \"packer restart\"' -RestartCheckCommand 'powershell -command "& {Write-Output "restarted."}"' -RestartTimeout '10m'
Name RestartCheckCommand RestartCommand RestartTimeout
---- ------------------- -------------- --------------
restcus powershell -command "& {Write-Output "restarted."}" shutdown /f /r /t 0 /c \"packer restart\" 10m
This command creates a restart customizer.
Example 5: Create a shell customizer.
New-AzImageBuilderTemplateCustomizerObject -ShellCustomizer -Name downloadBuildArtifacts -ScriptUri "https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh"
Name Inline ScriptUri Sha256Checksum
---- ------ --------- --------------
downloadBuildArtifacts https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh
This command creates a shell customizer.
Parameters
-Destination
The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
FileCustomizer
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-FileCustomizer
Uploads files to VMs (Linux, Windows).
Corresponds to Packer file provisioner.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
FileCustomizer
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Filter
Array of filters to select updates to apply.
Omit or specify empty array to use the default (no filter).
Refer to above link for examples and detailed description of this field.
Parameter properties
Type: String [ ]
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
WindowsUpdateCustomizer
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Inline
Array of PowerShell commands to execute.
Parameter properties
Type: String [ ]
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ShellCustomizer
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
PowerShellCustomizer
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 customization 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
-PowerShellCustomizer
Runs the specified PowerShell on the VM (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
PowerShellCustomizer
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-RestartCheckCommand
Command to check if restart succeeded [Default: ''].
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
RestartCustomizer
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-RestartCommand
Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer restart"'].
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
RestartCustomizer
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-RestartCustomizer
Reboots a VM and waits for it to come back online (Windows).
Corresponds to Packer windows-restart provisioner
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
RestartCustomizer
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-RestartTimeout
Restart timeout specified as a string of magnitude and unit, e.g.
'5m' (5 minutes) or '2h' (2 hours) [Default: '5m'].
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
RestartCustomizer
Position: Named
Mandatory: False
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
PowerShellCustomizer
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
PowerShellCustomizer
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 customizing.
It can be a github link, SAS URI for Azure Storage, etc.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ShellCustomizer
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
PowerShellCustomizer
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-SearchCriterion
Criteria to search updates.
Omit or specify empty string to use the default (search all).
Refer to above link for examples and detailed description of this field.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
WindowsUpdateCustomizer
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 file provided in the sourceUri field above.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
FileCustomizer
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ShellCustomizer
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
PowerShellCustomizer
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ShellCustomizer
Runs a shell script during the customization 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
ShellCustomizer
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-SourceUri
The URI of the file to be uploaded for customizing the VM.
It can be a github link, SAS URI for Azure Storage, etc.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
FileCustomizer
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-UpdateLimit
Maximum number of updates to apply at a time.
Omit or specify 0 to use the default (1000).
Parameter properties
Type: Int32
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
WindowsUpdateCustomizer
Position: Named
Mandatory: False
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
PowerShellCustomizer
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-WindowsUpdateCustomizer
Installs Windows Updates.
Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update )
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
WindowsUpdateCustomizer
Position: Named
Mandatory: True
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