Remove-AzureVMImage
從映像存放庫移除作業系統映像。
注意
本文件中參考的 Cmdlet 用於管理使用 Azure Service Manager(ASM) API 的舊版 Azure 資源。 建立新的資源時,不建議使用此舊版 PowerShell 模組,因為 ASM 已排定淘汰。 如需詳細資訊,請參閱 Azure Service Manager 淘汰。
Az PowerShell 模組是使用 PowerShell 管理 Azure Resource Manager (ARM) 資源的建議 PowerShell 模組。
語法
Remove-AzureVMImage
[-ImageName] <String>
[-DeleteVHD]
[-Profile <AzureSMProfile>]
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
Description
Remove-AzureVMImage Cmdlet 會從映射存放庫移除作業系統映射。 根據預設,此 Cmdlet 不會從記憶體帳戶中刪除相關聯的實體映像 Blob。 若要刪除相關聯的虛擬硬碟 (VHD),請使用 DeleteVHD 參數。
範例
範例 1:從映像存放庫移除映像
PS C:\> Remove-AzureVMImage -ImageName "Image001"
此命令會從映像存放庫移除名為 Image001 的映像。
範例 2:從映射存放庫移除映像,以及 VHD
PS C:\> Remove-AzureVMImage -ImageName " Image001" -DeleteVHD
此命令會從映像存放庫移除名為 Image001 的映像,也會從記憶體帳戶中刪除實體 VHD 映像。
範例 3:設定訂用帳戶內容,然後移除所有映像
PS C:\> $SubsId = <MySubscriptionID>
PS C:\> $Cert = Get-AzureCertificate cert:\LocalMachine\MY\<CertificateThumbprint>
PS C:\> Get-AzureVMImage `
| Where-Object {$_.Label -match "Beta" }`
| Foreach-Object {Remove-AzureVMImage -ImageName $_.name }
此命令會設定訂用帳戶內容,然後從標籤包含 Beta 名稱的映像存放庫移除所有映像。
參數
-DeleteVHD
指出此 Cmdlet 會從記憶體帳戶中刪除實體 VHD 映射 Blob。
類型: | SwitchParameter |
Position: | 1 |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-ImageName
指定要從映像存放庫移除的作業系統或虛擬機映像。
類型: | String |
Position: | 0 |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-InformationAction
指定此 Cmdlet 如何回應資訊事件。
此參數可接受的值為:
- 繼續
- 忽略
- 詢問
- SilentlyContinue
- 停止
- 暫止
類型: | ActionPreference |
別名: | infa |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-InformationVariable
指定資訊變數。
類型: | String |
別名: | iv |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Profile
指定此 Cmdlet 從中讀取的 Azure 設定檔。 如果您未指定設定檔,此 Cmdlet 會從本機預設配置檔讀取。
類型: | AzureSMProfile |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |