你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

New-AzGalleryImageDefinition

Create a gallery image definition.

Syntax

New-AzGalleryImageDefinition
   [-ResourceGroupName] <String>
   [-GalleryName] <String>
   [-Name] <String>
   [-AsJob]
   [-Location] <String>
   -Publisher <String>
   -Offer <String>
   -Sku <String>
   -OsState <OperatingSystemStateTypes>
   -OsType <OperatingSystemTypes>
   [-Description <String>]
   [-DisallowedDiskType <String[]>]
   [-EndOfLifeDate <DateTime>]
   [-Eula <String>]
   [-HyperVGeneration <String>]
   [-MinimumMemory <Int32>]
   [-MinimumVCPU <Int32>]
   [-MaximumMemory <Int32>]
   [-MaximumVCPU <Int32>]
   [-PrivacyStatementUri <String>]
   [-PurchasePlanName <String>]
   [-PurchasePlanProduct <String>]
   [-PurchasePlanPublisher <String>]
   [-ReleaseNoteUri <String>]
   [-Tag <Hashtable>]
   [-Feature <GalleryImageFeature[]>]
   [-Architecture <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Create a gallery image definition. The gallery image definition will default to 'HyperVGeneration: V2' and 'SecurityType: TrustedLaunchSupported' if -HyperVGeneration and -Feature @{Name: SecurityType} is not set explicitly. Set SecurityType to 'None' to opt out of this defaulting (See Example 10).

Examples

Example 1: Create an image definition for specialized linux images

$rgName = "myResourceGroup"
$galleryName = "myGallery"
$galleryImageDefinitionName = "myImage"
$location = "eastus"
$publisherName = "GreatPublisher"
$offerName = "GreatOffer"
$skuName = "GreatSku"
$description = "My gallery"
New-AzGalleryImageDefinition -ResourceGroupName $rgName -GalleryName $galleryName -Name $galleryImageDefinitionName -Location $location -Publisher $publisherName -Offer $offerName -Sku $skuName -OsState "Specialized" -OsType "Linux" -Description $description

Creates a gallery image definition to contain image versions for specialized linux images. This will default the Gallery Image to HyperVGeneration V2 and Trusted Launch as -HyperVGeneration and -Feature SecurityType is not set explicitly.

Example 2: Create an image definition for generalized linux images

$rgName = "myResourceGroup"
$galleryName = "myGallery"
$galleryImageDefinitionName = "myImage"
$location = "eastus"
$publisherName = "GreatPublisher"
$offerName = "GreatOffer"
$skuName = "GreatSku"
$description = "My gallery"
New-AzGalleryImageDefinition -ResourceGroupName $rgName -GalleryName $galleryName -Name $galleryImageDefinitionName -Location $location -Publisher $publisherName -Offer $offerName -Sku $skuName -OsState "Generalized" -OsType "Linux" -Description $description

Creates a gallery image definition to contain image versions for generalized linux images.

Example 3: Create an image definition for specialized windows images

$rgName = "myResourceGroup"
$galleryName = "myGallery"
$galleryImageDefinitionName = "myImage"
$location = "eastus"
$publisherName = "GreatPublisher"
$offerName = "GreatOffer"
$skuName = "GreatSku"
$description = "My gallery"
New-AzGalleryImageDefinition -ResourceGroupName $rgName -GalleryName $galleryName -Name $galleryImageDefinitionName -Location $location -Publisher $publisherName -Offer $offerName -Sku $skuName -OsState "Specialized" -OsType "Windows" -Description $description

Creates a gallery image definition to contain image versions for specialized windows images.

Example 4: Create an image definition for generalized windows images and set features.

$rgName = "myResourceGroup"
$galleryName = "myGallery"
$galleryImageDefinitionName = "myImage"
$location = "eastus"
$publisherName = "GreatPublisher"
$offerName = "GreatOffer"
$skuName = "GreatSku"
$description = "My gallery"
$IsHibernateSupported = @{Name='IsHibernateSupported';Value='True'}
$IsAcceleratedNetworkSupported = @{Name='IsAcceleratedNetworkSupported';Value='False'}
$ConfidentialVMSupported = @{Name='SecurityType';Value='ConfidentialVMSupported'}
$features = @($IsHibernateSupported,$IsAcceleratedNetworkSupported, $ConfidentialVMSupported)
New-AzGalleryImageDefinition -ResourceGroupName $rgName -GalleryName $galleryName -Name $galleryImageDefinitionName -Location $location -Publisher $publisherName -Offer $offerName -Sku $skuName -OsState "Generalized" -OsType "Windows" -Description $description -Feature $features -HyperVGeneration "V2"

Creates a gallery image definition to contain image versions for generalized windows images.

Example 5: Create an image definition with plan information

$rgName = "myResourceGroup"
$galleryName = "myGallery"
$galleryImageDefinitionName = "myImage"
$location = "eastus"
$publisherName = "GreatPublisher"
$offerName = "GreatOffer"
$skuName = "GreatSku"
$purchasePlanName = "myPlanName"
$purchasePlanProduct = "myPlanProduct"
$purchasePlanPublisher = "myPlanPublisher"
New-AzGalleryImageDefinition -ResourceGroupName $rgName -GalleryName $galleryName -Name $galleryImageDefinitionName -Location $location -Publisher $publisherName -Offer $offerName -Sku $skuName -OsState "Generalized" -OsType "Linux" -PurchasePlanName $purchasePlanName -PurchasePlanProduct $purchasePlanProduct -PurchasePlanPublisher $purchasePlanPublisher

Creates a gallery image definition for linux generalized images and define the plan name, product, and publisher. Only image versions that match the plan information can be added to this definition.

Example 6: Create an image definition and indicate end of life date

$rgName = "myResourceGroup"
$galleryName = "myGallery"
$galleryImageDefinitionName = "myImage"
$location = "eastus"
$publisherName = "GreatPublisher"
$offerName = "GreatOffer"
$skuName = "GreatSku"
$endOfLifeDate = "2024-08-02T00:00:00+00:00"
New-AzGalleryImageDefinition -ResourceGroupName $rgName -GalleryName $galleryName -Name $galleryImageDefinitionName -Location $location -Publisher $publisherName -Offer $offerName -Sku $skuName -OsState "Generalized" -OsType "Linux" -EndOfLifeDate $endOfLifeDate

This example has the end-of-life date for image definitions set to August 2, 2024 at mignight UTC. End-of-life dates can be specified for image definitions and image versions. Image definitions can still be used after the end-of-life dates.

Example 7: Create an image definition and recommend minimum and maximum CPU and memory (GB)

$rgName = "myResourceGroup"
$galleryName = "myGallery"
$galleryImageDefinitionName = "myImage"
$location = "eastus"
$publisherName = "GreatPublisher"
$offerName = "GreatOffer"
$skuName = "GreatSku"
$minMemory = 32
$maxMemory = 128
$minVCPU = 2
$maxVCPU = 8
New-AzGalleryImageDefinition -ResourceGroupName $rgName -GalleryName $galleryName -Name $galleryImageDefinitionName -Location $location -Publisher $publisherName -Offer $offerName -Sku $skuName -OsState "Generalized" -OsType "Linux" -MinimumMemory $minMemory -MaximumMemory $maxMemory -MinimumVCPU $minVCPU -MaximumVCPU $maxVCPU

Creates a gallery image definition and recommends the minimum and maximum ranges for the CPU and memory that the image versions in this image definition support. Image versions can still be used to create virtual machines with memory and vCPU settings outside the recommended ranges.

$rgName = "myResourceGroup"
$galleryName = "myGallery"
$galleryImageDefinitionName = "myImage"
$location = "eastus"
$publisherName = "GreatPublisher"
$offerName = "GreatOffer"
$skuName = "GreatSku"
$disallowedDiskTypes = @("Standard_LRS")
New-AzGalleryImageDefinition -ResourceGroupName $rgName -GalleryName $galleryName -Name $galleryImageDefinitionName -Location $location -Publisher $publisherName -Offer $offerName -Sku $skuName -OsState "Generalized" -OsType "Linux" -DisallowedDiskType $disallowedDiskTypes

Creates a gallery image definition and indicate which OS disk types may not be compatible with image versions within this image definition. Image versions can still be used to create virtual machines with an OS disk that is one of the disallowed disk types.

Example 9: Create an image definition and provide the EULA, privacy statement URI, and release notes URI

$rgName = "myResourceGroup"
$galleryName = "myGallery"
$galleryImageDefinitionName = "myImage"
$location = "eastus"
$publisherName = "GreatPublisher"
$offerName = "GreatOffer"
$skuName = "GreatSku"
$eula = "https://myeula"
$privacyStatementUri = "https://mystatement"
$releaseNoteUri = "https://myreleasenotes"
New-AzGalleryImageDefinition -ResourceGroupName $rgName -GalleryName $galleryName -Name $galleryImageDefinitionName -Location $location -Publisher $publisherName -Offer $offerName -Sku $skuName -OsState "Generalized" -OsType "Linux" -Eula $eula -PrivacyStatementUri $privacyStatementUri -ReleaseNoteUri $releaseNoteUri

Creates a gallery image definition for linux generalized images and specify either the string or path to an EULA agreement, privacy statement, and release notes tied to all image versions in the image definition.

$rgName = "myResourceGroup"
$galleryName = "myGallery"
$galleryImageDefinitionName = "myImage"
$location = "eastus"
$publisherName = "GreatPublisher"
$offerName = "GreatOffer"
$skuName = "GreatSku"

$Feature1 = @{Name='SecurityType';Value='None'}
$Features = @($Feature1)

New-AzGalleryImageDefinition -ResourceGroupName $rgName -GalleryName $galleryName -Name $galleryImageDefinitionName -Location $location -Publisher $publisherName -Offer $offerName -Sku $skuName -OsState "Generalized" -OsType "Linux" -Feature $Features

Create a gallery image definition with standard security type feature by providing 'None' as the value of the SecurityType feature.

Parameters

-Architecture

CPU architecture supported by an OS disk. Possible values are "X64" and "Arm64".

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

-AsJob

Run cmdlet in the background

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

-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

-Description

The description of the gallery image Definition resource.

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

-DisallowedDiskType

The disallowed disk types.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-EndOfLifeDate

The end of life date of the gallery Image Definition

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

-Eula

The Eula agreement for the gallery Image Definition.

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

-Feature

A list of gallery image features. For SecurityType, acceptable inputs are: None, TrustedlaunchSupported, Trustedlaunch, ConfidentialVM, ConfidentialVMSupported, TrustedLaunchAndConfidentialVmSupported

Type:GalleryImageFeature[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-GalleryName

The name of the gallery.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-HyperVGeneration

The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Allowed values are V1 and V2.

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

-Location

Resource location

Type:String
Position:3
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-MaximumMemory

The maximum of the recommended memory

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

-MaximumVCPU

The maximum of the recommended CPU core

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

-MinimumMemory

The minimum of the recommended memory

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

-MinimumVCPU

The minimum of the recommended CPU core

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

-Name

The name of the gallery image definition.

Type:String
Aliases:GalleryImageDefinitionName
Position:2
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Offer

The name of the gallery Image Definition offer.

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

-OsState

The state of OS

Type:OperatingSystemStateTypes
Accepted values:Generalized, Specialized
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-OsType

The type of OS

Type:OperatingSystemTypes
Accepted values:Windows, Linux
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PrivacyStatementUri

The privacy statement uri.

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

-Publisher

The name of the gallery Image Definition publisher.

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

-PurchasePlanName

The ID for the purchase plan.

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

-PurchasePlanProduct

The product ID for the purchase plan.

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

-PurchasePlanPublisher

The publisher ID for the purchase plan.

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

-ReleaseNoteUri

The release note uri.

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

-ResourceGroupName

The name of the resource group.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Sku

The name of the gallery Image Definition SKU.

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

-Tag

Resource tags

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:True
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

String

OperatingSystemStateTypes

OperatingSystemTypes

DateTime

Hashtable

Int32

String[]

Outputs

PSGalleryImage