Edit

Share via


New-AzStackHCIVMImage

The operation to create an image. Please note some properties can be set only during image creation.

Syntax

MarketplaceURN (Default)

New-AzStackHCIVMImage
    -Name <String>
    -ResourceGroupName <String>
    -Location <String>
    -CustomLocationId <String>
    -OSType <Object>
    -URN <String>
    [-SubscriptionId <String>]
    [-CloudInitDataSource <String>]
    [-StoragePathName <String>]
    [-StoragePathResourceGroup <String>]
    [-StoragePathId <String>]
    [-Tag <Hashtable>]
    [-DefaultProfile <PSObject>]
    [-AsJob]
    [-NoWait]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

GalleryImage

New-AzStackHCIVMImage
    -Name <String>
    -ResourceGroupName <String>
    -Location <String>
    -CustomLocationId <String>
    -OSType <Object>
    -ImagePath <String>
    [-SubscriptionId <String>]
    [-CloudInitDataSource <String>]
    [-StoragePathName <String>]
    [-StoragePathResourceGroup <String>]
    [-StoragePathId <String>]
    [-Tag <Hashtable>]
    [-DefaultProfile <PSObject>]
    [-AsJob]
    [-NoWait]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Marketplace

New-AzStackHCIVMImage
    -Name <String>
    -ResourceGroupName <String>
    -Location <String>
    -CustomLocationId <String>
    -OSType <Object>
    -Offer <String>
    -Publisher <String>
    -Sku <String>
    -Version <String>
    [-SubscriptionId <String>]
    [-CloudInitDataSource <String>]
    [-StoragePathName <String>]
    [-StoragePathResourceGroup <String>]
    [-StoragePathId <String>]
    [-Tag <Hashtable>]
    [-DefaultProfile <PSObject>]
    [-AsJob]
    [-NoWait]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The operation to create an image. Please note some properties can be set only during image creation.

Examples

New-AzStackHCIVMImage -Name "testImage" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -ImagePath "C:\ClusterStorage\Volume1\Ubunut.vhdx" -OSType "Linux" -Location "eastus"
Name            ResourceGroupName
----            -----------------
testImage       test-rg

This command creates a gallery image from a local path.

New-AzStackHCIVMImage -Name "testMarketplaceImage" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}"  -Location "eastus" -Offer "windowsserver" -Publisher "MicrosoftWindowsServer" -Sku "2022-Datacenter" -Version "latest" -OSType "Windows"
Name            ResourceGroupName
----            -----------------
testMarketplaceImage       test-rg

This command creates a marketplace gallery image using the specified offer , publisher, sku and version.

New-AzStackHCIVMImage -Name "testMarketplaceImageURN" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}"  -Location "eastus" -URN  "microsoftwindowsserver:windowsserver:2022-datacenter:latest" -OSType "Windows"
Name            ResourceGroupName
----            -----------------
testMarketplaceImageURN       test-rg

This command creates a marketplace gallery image using the specified urn.

Parameters

-AsJob

Run the command as a job

Parameter properties

Type:SwitchParameter
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

-CloudInitDataSource

Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure]

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

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

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

Parameter sets

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

-CustomLocationId

The ARM Id of the extended location to create image resource in.

Parameter properties

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

Parameter sets

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

-DefaultProfile

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

Parameter properties

Type:PSObject
Default value:None
Supports wildcards:False
DontShow:False
Aliases: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

-ImagePath

Local path of image that the image should be created from.

This parameter is required for non marketplace images.

Parameter properties

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

Parameter sets

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

-Location

The geo-location where the resource lives

Parameter properties

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

Parameter sets

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

-Name

Name of the Image The name must start and end with an alphanumeric character and must contain all alphanumeric characters or '-', '.', or '_'. The max length can be 80 characters and the minimum length is 1 character.

Parameter properties

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

Parameter sets

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

-NoWait

Run the command asynchronously

Parameter properties

Type:SwitchParameter
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

-Offer

The name of the marketplace gallery image definition offer.

Parameter properties

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

Parameter sets

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

-OSType

Operating system type that the gallery image uses [Windows, Linux]

Parameter properties

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

Parameter sets

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

-Publisher

The name of the marketplace gallery image definition publisher.

Parameter properties

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

Parameter sets

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

-ResourceGroupName

The name of the resource group. The name is case insensitive.

Parameter properties

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

Parameter sets

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

-Sku

The name of the marketplace gallery image definition SKU.

Parameter properties

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

Parameter sets

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

-StoragePathId

Storage ContainerID of the storage container to be used for gallery image

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

-StoragePathName

Storage Container Name of the storage container to be used for gallery image

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

-StoragePathResourceGroup

Resource Group of the Storage Path. The Default value is the Resource Group of the Image.

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

-SubscriptionId

The ID of the target subscription.

Parameter properties

Type:String
Default value:(Get-AzContext).Subscription.Id
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

-Tag

Resource tags.

Parameter properties

Type:Hashtable
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

-URN

The URN of the marketplace gallery image.

Parameter properties

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

Parameter sets

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

-Version

The version of the marketplace gallery image.

Parameter properties

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

Parameter sets

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

-WhatIf

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

Parameter properties

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

Parameter sets

(All)
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

IGalleryImages

IMarketplaceGalleryImages