Edit

Share via


Set-AzVMPlan

Sets the Marketplace plan information on a virtual machine.

Syntax

Default (Default)

Set-AzVMPlan
    [-VM] <PSVirtualMachine>
    [-Name] <String>
    [[-Product] <String>]
    [[-PromotionCode] <String>]
    [[-Publisher] <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Set-AzVMPlan cmdlet sets the Azure Marketplace plan information for a virtual machine. Before being able to deploy a Marketplace image through the command-line, programmatic access must be enabled or the virtual machine must be deployed by using the Azure portal.

Examples

Example 1

New-AzVMConfig -VMName "VirtualMachine07" -VMSize "Standard_B1s" |
    Set-AzVMPlan -Publisher "Canonical" -Product "UbuntuServer" -Name "18.04-LTS"
Name            : VirtualMachine07
HardwareProfile : {VmSize}
Plan            : {Name, Publisher, Product}

Parameters

-DefaultProfile

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

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

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

-Name

Specifies the name of the image from the Marketplace. This is the same value that is returned by the Get-AzVMImageSku cmdlet. For more information about how to find image information, see Find and use Azure Marketplace VM images with Azure PowerShell in the Microsoft Azure documentation.

Parameter properties

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

Parameter sets

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

-Product

Specifies the product of the image from the Marketplace. This is the same information as the Offer value of the imageReference element.

Parameter properties

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

Parameter sets

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

-PromotionCode

Specifies a promotion code.

Parameter properties

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

Parameter sets

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

-Publisher

Specifies the publisher of the image. You can find this information by using the Get-AzVMImagePublisher cmdlet.

Parameter properties

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

Parameter sets

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

-VM

Specifies the virtual machine object for which to set a Marketplace plan. You can use the Get-AzVM cmdlet to obtain a virtual machine object. You can use the New-AzVMConfig cmdlet to create a virtual machine object.

Parameter properties

Type:PSVirtualMachine
Default value:None
Supports wildcards:False
DontShow:False
Aliases:VMProfile

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
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.

Inputs

PSVirtualMachine

String

Outputs

PSVirtualMachine