Redigera

Dela via


Add-AzVmGalleryApplication

Add a GalleryApplication object to the PSVirtualMachine object.

Syntax

Add-AzVmGalleryApplication
   -VM <PSVirtualMachine>
   -GalleryApplication <PSVMGalleryApplication>
   [-Order <Int32>]
   [-TreatFailureAsDeploymentFailure]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Adds a GalleryApplication object to the PSVirtualMachine object.

Examples

Example 1

$vm = Get-AzVM -ResourceGroupName $rgName -Name $vmName
$vmGal = New-AzVmGalleryApplication -PackageReferenceId $packageRefId -ConfigReferenceId $configRefId
Add-AzVmGalleryApplication -VM $vm -GalleryApplication $vmGal -Order 1

This example creates a local VMGalleryApplication object and adds it to a PSVirtualMachine object.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-GalleryApplication

PSVMGalleryApplication Object.

Type:PSVMGalleryApplication
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Order

Order in which the application will be install in.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TreatFailureAsDeploymentFailure

If true, any failure for any operation in the VmApplication will fail the deployment. Defaults to false if not specified.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-VM

The PSVirtualMachine object to add a Gallery Application Reference ID.

Type:PSVirtualMachine
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

PSVirtualMachine