你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Add-AzureVMImage
将新的操作系统映像或新的虚拟机映像添加到映像存储库。
注意
本文档中引用的 cmdlet 用于管理使用 Azure Service Manager (ASM) API 的旧式 Azure 资源。 创建新资源时,建议不要使用旧的 PowerShell 模块,因为计划将停用 ASM。 有关详细信息,请参阅 Azure Service Manager 停用。
Az PowerShell 模块是建议用于管理 PowerShell 的 Azure 资源管理器 (ARM) 资源的 PowerShell 模块。
语法
Add-AzureVMImage
[-ImageName] <String>
[-MediaLocation] <String>
[-OS] <String>
[[-Label] <String>]
[[-Eula] <String>]
[[-Description] <String>]
[[-ImageFamily] <String>]
[[-PublishedDate] <DateTime>]
[[-PrivacyUri] <Uri>]
[[-RecommendedVMSize] <String>]
[[-IconName] <String>]
[[-SmallIconName] <String>]
[-ShowInGui]
[-Profile <AzureSMProfile>]
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
Add-AzureVMImage
[-ImageName] <String>
[-DiskConfig] <VirtualMachineImageDiskConfigSet>
[[-OS] <String>]
[[-Label] <String>]
[[-Eula] <String>]
[[-Description] <String>]
[[-ImageFamily] <String>]
[[-PublishedDate] <DateTime>]
[[-PrivacyUri] <Uri>]
[[-RecommendedVMSize] <String>]
[[-IconName] <String>]
[[-SmallIconName] <String>]
[-ShowInGui]
[-Profile <AzureSMProfile>]
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
说明
Add-AzureVMImage cmdlet 向映像存储库添加新的操作系统映像或新的虚拟机映像。 该映像是一个通用操作系统映像,使用适用于 Windows 的 Sysprep,或者对于 Linux,使用适用于分发的相应工具。
示例
示例 1:将操作系统映像添加到存储库
PS C:\> $S = New-AzureVMImageDiskConfigSet
PS C:\> Set-AzureVMImageOSDiskConfig -DiskConfig $S -HostCaching ReadWrite -OSState "Generalized" -OS "Windows" -MediaLink $Link
PS C:\> Set-AzureVMImageDataDiskConfig -DiskConfig $S -DataDiskName "Test1" -HostCaching ReadWrite -Lun 0 -MediaLink $Link1
PS C:\> Set-AzureVMImageDataDiskConfig -DiskConfig $S -DataDiskName "Test4" -HostCaching ReadWrite -Lun 0 -MediaLink $Link
PS C:\> Remove-AzureVMImageDataDiskConfig -DiskConfig $S -DataDiskName "Test4"
PS C:\> $IMGName = "TestCREATEvmimage2";
PS C:\> Add-AzureVMImage -ImageName $IMGName -Label "Test1" -Description "Test1" -DiskConfig $S -Eula "http://www.contoso.com" -ImageFamily Windows -PublishedDate (Get-Date) -PrivacyUri "http://www.test.com" -RecommendedVMSize Small -IconName "Icon01" -SmallIconName "SmallIcon01" -ShowInGui
此示例将操作系统映像添加到存储库。
参数
-Description
指定操作系统映像的说明。
类型: | String |
Position: | 5 |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-DiskConfig
指定虚拟机映像的操作系统磁盘配置。
类型: | VirtualMachineImageDiskConfigSet |
Position: | 1 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-Eula
指定最终用户许可协议。 建议对此值使用 URL。
类型: | String |
Position: | 4 |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-IconName
指定将映像添加到存储库时使用的图标的名称。
类型: | String |
别名: | IconUri |
Position: | 10 |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-ImageFamily
指定用于对操作系统映像进行分组的值。
类型: | String |
Position: | 6 |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-ImageName
指定要添加到映像存储库中的映像的名称。
类型: | String |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-InformationAction
指定此 cmdlet 如何响应信息事件。
此参数的可接受值为:
- Continue
- 忽略
- 询问
- SilentlyContinue
- 停止
- Suspend
类型: | ActionPreference |
别名: | infa |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-InformationVariable
指定信息变量。
类型: | String |
别名: | iv |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Label
指定要为图像提供标签。
类型: | String |
Position: | 3 |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-MediaLocation
指定映像所在的物理 Blob 页的位置。 这是指向当前订阅存储中的 Blob 页的链接。
类型: | String |
Position: | 1 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-OS
指定映像的操作系统版本。
类型: | String |
Position: | 2 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-PrivacyUri
指定指向包含与操作系统映像相关的隐私策略的文档的 URL。
类型: | Uri |
Position: | 8 |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-Profile
指定此 cmdlet 从中读取的 Azure 配置文件。 如果未指定配置文件,此 cmdlet 将从本地默认配置文件中读取。
类型: | AzureSMProfile |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-PublishedDate
指定将操作系统映像添加到映像存储库的日期。
类型: | DateTime |
Position: | 7 |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-RecommendedVMSize
指定要用于从操作系统映像创建的虚拟机的大小。
此参数的可接受值为:
- 中
- 大型
- 特大
- A5
- A6
- A7
类型: | String |
Position: | 9 |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-ShowInGui
指示此 cmdlet 在 GUI 中显示图像。
类型: | SwitchParameter |
Position: | 12 |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-SmallIconName
指定将映像添加到存储库时使用的小型图标的名称。
类型: | String |
别名: | SmallIconUri |
Position: | 11 |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
输出
OSImageContext