New-AzStackHCIVMImage

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

Syntax

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

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

-CloudInitDataSource

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

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

-CustomLocationId

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

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

-DefaultProfile

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

Type:PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ImagePath

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

This parameter is required for non marketplace images.

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

-Location

The geo-location where the resource lives

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

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

-NoWait

Run the command asynchronously

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

-Offer

The name of the marketplae gallery image definition offer.

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

-OSType

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

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

-Publisher

The name of the marketplace gallery image definition publisher.

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

-ResourceGroupName

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

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

-Sku

The name of the marketplace gallery image definition SKU.

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

-StoragePathId

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

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

-StoragePathName

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

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

-StoragePathResourceGroup

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

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

-SubscriptionId

The ID of the target subscription.

Type:String
Position:Named
Default value:(Get-AzContext).Subscription.Id
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Tag

Resource tags.

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

-URN

The URN of the marketplace gallery image.

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

-Version

The version of the marketplace gallery image.

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

Outputs

IGalleryImages

IMarketplaceGalleryImages