Remove-AzureVMImage

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Remove-AzureVMImage

Removes an operating system image from the Image Repository.

Parameter Set: Default
Remove-AzureVMImage [-ImageName] <String> [-DeleteVHD] [ <CommonParameters>]

This topic describes the cmdlet in the .6.19 version of the Windows Azure PowerShell module. To find out the version of the module you're using, from the Windows Azure PowerShell console, type (get-module azure).version.

The Remove-AzureVMImage cmdlet removes an operating system image from the image repository. By default, this cmdlet doesn’t delete the associated physical image blob from the storage account. To delete the associated VHD, use the DeleteVHD parameter.

-DeleteVHD

When specified, deletes the physical VHD image blob from the storage account.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ImageName<String>

Specifies the operating system image to remove from the image repository.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Example 1

This command removes the "MyOSImage" image from the image repository.

C:\PS>Remove-AzureVMImage -ImageName MyOSImage

Example 2

This command removes the "MyOSImage" image from the image repository and also deletes the physical VHD image from the storage account.

C:\PS>Remove-AzureVMImage -ImageName MyOSImage –DeleteVHD 

Example 3

This command sets the subscription context and then removes all the images from the image repository whose Label includes “Beta”.

C:\PS>$subsId = <MySubscriptionID>
C:\PS>$cert = Get-AzureCertificate cert:\LocalMachine\MY\<CertificateThumbprint>
C:\PS>Get-AzureVMImage `
| Where-Object {$_.Label -match "Beta" }`
| Foreach-Object {Remove-AzureVMImage –ImageName $_.name } 

Add-AzureVMImage

Get-AzureVMImage

Update-AzureVMImage

Manage Images and Disks Using Windows Azure Cmdlets