你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Microsoft.VirtualMachineImages imageTemplates 2019-02-01-preview

Bicep 资源定义

imageTemplates 资源类型可以部署到:

有关每个 API 版本中更改的属性的列表,请参阅 更改日志

资源格式

若要创建 Microsoft.VirtualMachineImages/imageTemplates 资源,请将以下 Bicep 添加到模板。

resource symbolicname 'Microsoft.VirtualMachineImages/imageTemplates@2019-02-01-preview' = {
  name: 'string'
  location: 'string'
  tags: {
    tagName1: 'tagValue1'
    tagName2: 'tagValue2'
  }
  properties: {
    customize: [
      {
        name: 'string'
        type: 'string'
        // For remaining properties, see ImageTemplateCustomizer objects
      }
    ]
    distribute: [
      {
        artifactTags: {}
        runOutputName: 'string'
        type: 'string'
        // For remaining properties, see ImageTemplateDistributor objects
      }
    ]
    source: {
      type: 'string'
      // For remaining properties, see ImageTemplateSource objects
    }
  }
}

ImageTemplateCustomizer 对象

设置 type 属性以指定对象的类型。

对于 PowerShell,请使用:

  type: 'PowerShell'
  inline: [
    'string'
  ]
  script: 'string'
  validExitCodes: [
    int
  ]

对于 Shell,请使用:

  type: 'Shell'
  inline: [
    'string'
  ]
  script: 'string'

对于 WindowsRestart,请使用:

  type: 'WindowsRestart'
  restartCheckCommand: 'string'
  restartCommand: 'string'
  restartTimeout: 'string'

ImageTemplateDistributor 对象

设置 type 属性以指定对象的类型。

对于 ManagedImage,请使用:

  type: 'ManagedImage'
  imageId: 'string'
  location: 'string'

对于 SharedImage,请使用:

  type: 'SharedImage'
  galleryImageId: 'string'
  replicationRegions: [
    'string'
  ]

对于 VHD,请使用:

  type: 'VHD'

ImageTemplateSource 对象

设置 type 属性以指定对象的类型。

对于 ISO,请使用:

  type: 'ISO'
  sha256Checksum: 'string'
  sourceURI: 'string'

对于 ManagedImage,请使用:

  type: 'ManagedImage'
  imageId: 'string'

对于 PlatformImage,请使用:

  type: 'PlatformImage'
  offer: 'string'
  publisher: 'string'
  sku: 'string'
  version: 'string'

属性值

imageTemplates

名称 说明
name 资源名称 字符串 (必需)
location 资源位置 字符串 (必需)
标记 资源标记 标记名称和值的字典。 请参阅 模板中的标记
properties ImageTemplateProperties

ImageTemplateProperties

名称 说明
自定义 指定用于描述图像的自定义步骤的属性,如图像源等 ImageTemplateCustomizer[]
分发 (distribute) 映像输出需要转到的分发目标。 ImageTemplateDistributor[] (必需的)
source 指定用于描述源图像的属性。 ImageTemplateSource (必需)

ImageTemplateCustomizer

名称 说明
name 友好名称,用于提供有关此自定义步骤的上下文 字符串
type 设置对象类型 PowerShell
Shell
WindowsRestart (必需)

ImageTemplatePowerShellCustomizer

名称 说明 Value
type 要在映像上使用的自定义工具的类型。 例如,“Shell”可以是 shell 定制器 “PowerShell” (必需)
inline 要执行的 PowerShell 命令数组 string[]
脚本 要运行用于自定义的 PowerShell 脚本。 它可以是 github 链接、Azure 存储的 SAS URI 等 string
validExitCodes PowerShell 脚本的有效退出代码。 [默认值:0] int[]

ImageTemplateShellCustomizer

名称 说明 Value
type 要在映像上使用的自定义工具的类型。 例如,“Shell”可以是 shell 定制器 “Shell” (必需)
inline 要执行的 shell 命令数组 string[]
脚本 要运行用于自定义的 shell 脚本。 它可以是 github 链接、Azure 存储的 SAS URI 等 字符串

ImageTemplateRestartCustomizer

名称 说明 Value
type 要在映像上使用的自定义工具的类型。 例如,“Shell”可以是 shell 定制器 “WindowsRestart” (必需)
restartCheckCommand 重启成功时检查的命令 [默认值: ''] 字符串
restartCommand 用于执行重启的命令 [默认值:'shutdown /r /f /t 0 /c “packer restart”'] string
restartTimeout 重启超时指定为数量级和单位字符串,例如“5m” (5 分钟) 或“2h” (2 小时) [默认值:'5m'] string

ImageTemplateDistributor

名称 说明
artifactTags 分发服务器创建/更新项目后将应用于项目的标记。 对象 (object)
runOutputName 要用于关联的 RunOutput 的名称。 字符串 (必需)
类型 设置对象类型 ManagedImage
SharedImage
所需的 VHD ()

ImageTemplateManagedImageDistributor

名称 说明 Value
type 分发类型。 “ManagedImage” (必需)
imageId 托管磁盘映像的资源 ID 字符串 (必需)
location 映像的 Azure 位置(如果映像已存在)应匹配 字符串 (必需)

ImageTemplateSharedImageDistributor

名称 说明 Value
type 分发类型。 “SharedImage” (必需)
galleryImageId 共享映像库映像的资源 ID 字符串 (必需)
replicationRegions string[] (必需的)

ImageTemplateVhdDistributor

名称 说明 Value
type 分发类型。 “VHD” (必需)

ImageTemplateSource

名称 说明 Value
type 设置对象类型 ISO
ManagedImage
PlatformImage (必需)

ImageTemplateIsoSource

名称 说明 Value
type 指定要从头开始使用的源图像的类型。 “ISO” (必需的)
sha256Checksum ISO 映像的 SHA256 校验和。 字符串 (必需)
sourceURI 用于获取 ISO 映像的 URI。 创建映像模板时,资源提供程序必须可以访问此 URI。 字符串 (必需)

ImageTemplateManagedImageSource

名称 说明 Value
type 指定要从头开始使用的源图像的类型。 “ManagedImage” (必需)
imageId 客户订阅中托管映像的 ARM 资源 ID 字符串 (必需)

ImageTemplatePlatformImageSource

名称 说明 Value
type 指定要从头开始使用的源图像的类型。 “PlatformImage” (必需)
offer Azure 库映像中的映像套餐。 字符串
发布者 Azure 库映像中的映像发布服务器。 字符串
sku Azure 库映像中的映像 SKU。 string
版本 Azure 库映像中的映像版本。 字符串

快速入门模板

以下快速入门模板部署此资源类型。

模板 说明
使用 Azure Windows 基线的 Azure 映像生成器

部署到 Azure
创建 Azure 映像生成器环境并生成应用了最新 Windows 汇报和 Azure Windows 基线的 Windows Server 映像。
配置 Dev Box 服务

部署到 Azure
此模板将按照 Dev Box 快速入门指南创建所有 Dev Box 管理员资源。 可以查看创建的所有资源,也可以直接转到 DevPortal.microsoft.com 创建第一个 Dev Box。

ARM 模板资源定义

imageTemplates 资源类型可以部署到:

有关每个 API 版本中更改的属性的列表,请参阅 更改日志

资源格式

若要创建 Microsoft.VirtualMachineImages/imageTemplates 资源,请将以下 JSON 添加到模板。

{
  "type": "Microsoft.VirtualMachineImages/imageTemplates",
  "apiVersion": "2019-02-01-preview",
  "name": "string",
  "location": "string",
  "tags": {
    "tagName1": "tagValue1",
    "tagName2": "tagValue2"
  },
  "properties": {
    "customize": [
      {
        "name": "string",
        "type": "string"
        // For remaining properties, see ImageTemplateCustomizer objects
      }
    ],
    "distribute": [
      {
        "artifactTags": {},
        "runOutputName": "string",
        "type": "string"
        // For remaining properties, see ImageTemplateDistributor objects
      }
    ],
    "source": {
      "type": "string"
      // For remaining properties, see ImageTemplateSource objects
    }
  }
}

ImageTemplateCustomizer 对象

设置 type 属性以指定对象的类型。

对于 PowerShell,请使用:

  "type": "PowerShell",
  "inline": [ "string" ],
  "script": "string",
  "validExitCodes": [ "int" ]

对于 Shell,请使用:

  "type": "Shell",
  "inline": [ "string" ],
  "script": "string"

对于 WindowsRestart,请使用:

  "type": "WindowsRestart",
  "restartCheckCommand": "string",
  "restartCommand": "string",
  "restartTimeout": "string"

ImageTemplateDistributor 对象

设置 type 属性以指定对象的类型。

对于 ManagedImage,请使用:

  "type": "ManagedImage",
  "imageId": "string",
  "location": "string"

对于 SharedImage,请使用:

  "type": "SharedImage",
  "galleryImageId": "string",
  "replicationRegions": [ "string" ]

对于 VHD,请使用:

  "type": "VHD"

ImageTemplateSource 对象

设置 type 属性以指定对象的类型。

对于 ISO,请使用:

  "type": "ISO",
  "sha256Checksum": "string",
  "sourceURI": "string"

对于 ManagedImage,请使用:

  "type": "ManagedImage",
  "imageId": "string"

对于 PlatformImage,请使用:

  "type": "PlatformImage",
  "offer": "string",
  "publisher": "string",
  "sku": "string",
  "version": "string"

属性值

imageTemplates

名称 说明 Value
type 资源类型 “Microsoft.VirtualMachineImages/imageTemplates”
apiVersion 资源 API 版本 “2019-02-01-preview”
name 资源名称 字符串 (必需)
location 资源位置 字符串 (必需)
标记 资源标记 标记名称和值的字典。 请参阅 模板中的标记
properties ImageTemplateProperties

ImageTemplateProperties

名称 说明
自定义 指定用于描述图像的自定义步骤的属性,如图像源等 ImageTemplateCustomizer[]
分发 (distribute) 映像输出需要转到的分发目标。 ImageTemplateDistributor[] (必需的)
source 指定用于描述源图像的属性。 ImageTemplateSource (必需)

ImageTemplateCustomizer

名称 说明
name 友好名称,用于提供有关此自定义步骤的上下文 字符串
type 设置对象类型 PowerShell
Shell
WindowsRestart (必需)

ImageTemplatePowerShellCustomizer

名称 说明 Value
type 要在映像上使用的自定义工具的类型。 例如,“Shell”可以是 shell 定制器 “PowerShell” (必需)
inline 要执行的 PowerShell 命令数组 string[]
脚本 要运行用于自定义的 PowerShell 脚本。 它可以是 github 链接、Azure 存储的 SAS URI 等 字符串
validExitCodes PowerShell 脚本的有效退出代码。 [默认值:0] int[]

ImageTemplateShellCustomizer

名称 说明 Value
type 要在映像上使用的自定义工具的类型。 例如,“Shell”可以是 shell 定制器 “Shell” (必需)
inline 要执行的 shell 命令数组 string[]
脚本 要运行用于自定义的 shell 脚本。 它可以是 github 链接、Azure 存储的 SAS URI 等 string

ImageTemplateRestartCustomizer

名称 说明 Value
type 要在映像上使用的自定义工具的类型。 例如,“Shell”可以是 shell 定制器 “WindowsRestart” (必需)
restartCheckCommand 重启成功时检查的命令 [默认值: ''] string
restartCommand 用于执行重启的命令 [默认值:'shutdown /r /f /t 0 /c “packer restart”'] string
restartTimeout 重启超时指定为数量级和单位字符串,例如“5m” (5 分钟) 或“2h” (2 小时) [默认值:'5m'] 字符串

ImageTemplateDistributor

名称 说明
artifactTags 分发服务器创建/更新项目后将应用于项目的标记。 对象 (object)
runOutputName 要用于关联的 RunOutput 的名称。 字符串 (必需)
类型 设置对象类型 ManagedImage
SharedImage
所需的 VHD ()

ImageTemplateManagedImageDistributor

名称 说明 Value
type 分发类型。 “ManagedImage” (必需)
imageId 托管磁盘映像的资源 ID 字符串 (必需)
location 映像的 Azure 位置(如果映像已存在)应匹配 字符串 (必需)

ImageTemplateSharedImageDistributor

名称 说明 Value
type 分发类型。 “SharedImage” (必需)
galleryImageId 共享映像库映像的资源 ID 字符串 (必需)
replicationRegions string[] (必需的)

ImageTemplateVhdDistributor

名称 说明 Value
type 分发类型。 “VHD” (必需)

ImageTemplateSource

名称 说明 Value
type 设置对象类型 ISO
ManagedImage
PlatformImage (必需)

ImageTemplateIsoSource

名称 说明 Value
type 指定要开始使用的源映像的类型。 需要“ISO” ()
sha256Checksum ISO 映像的 SHA256 校验和。 字符串 (必需)
sourceURI 用于获取 ISO 映像的 URI。 创建映像模板时,资源提供程序必须可访问此 URI。 字符串 (必需)

ImageTemplateManagedImageSource

名称 说明 Value
type 指定要开始使用的源映像的类型。 需要“ManagedImage” ()
imageId 客户订阅中托管映像的 ARM 资源 ID 字符串 (必需)

ImageTemplatePlatformImageSource

名称 说明 Value
type 指定要开始使用的源映像的类型。 “PlatformImage” (必需)
offer Azure 库映像中的映像产品/服务。 字符串
发布者 Azure 库映像中的映像发布者。 字符串
sku Azure 库映像中的映像 SKU。 字符串
版本 Azure 库映像中的映像版本。 字符串

快速入门模板

以下快速入门模板部署此资源类型。

模板 说明
使用 Azure Windows 基线的 Azure 映像生成器

部署到 Azure
创建 Azure 映像生成器环境,并生成应用了最新 Windows 汇报和 Azure Windows 基线的 Windows Server 映像。
配置 Dev Box 服务

部署到 Azure
此模板将按照 Dev Box 快速入门指南创建所有 Dev Box 管理员资源。 可以查看创建的所有资源,也可以直接转到 DevPortal.microsoft.com 创建第一个 Dev Box。

Terraform (AzAPI 提供程序) 资源定义

imageTemplates 资源类型可以部署到:

  • 资源组

有关每个 API 版本中已更改属性的列表,请参阅 更改日志

资源格式

若要创建 Microsoft.VirtualMachineImages/imageTemplates 资源,请将以下 Terraform 添加到模板。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.VirtualMachineImages/imageTemplates@2019-02-01-preview"
  name = "string"
  location = "string"
  parent_id = "string"
  tags = {
    tagName1 = "tagValue1"
    tagName2 = "tagValue2"
  }
  body = jsonencode({
    properties = {
      customize = [
        {
          name = "string"
          type = "string"
          // For remaining properties, see ImageTemplateCustomizer objects
        }
      ]
      distribute = [
        {
          artifactTags = {}
          runOutputName = "string"
          type = "string"
          // For remaining properties, see ImageTemplateDistributor objects
        }
      ]
      source = {
        type = "string"
        // For remaining properties, see ImageTemplateSource objects
      }
    }
  })
}

ImageTemplateCustomizer 对象

设置 type 属性以指定对象的类型。

对于 PowerShell,请使用:

  type = "PowerShell"
  inline = [
    "string"
  ]
  script = "string"
  validExitCodes = [
    int
  ]

对于 Shell,请使用:

  type = "Shell"
  inline = [
    "string"
  ]
  script = "string"

对于 WindowsRestart,请使用:

  type = "WindowsRestart"
  restartCheckCommand = "string"
  restartCommand = "string"
  restartTimeout = "string"

ImageTemplateDistributor 对象

设置 type 属性以指定对象的类型。

对于 ManagedImage,请使用:

  type = "ManagedImage"
  imageId = "string"
  location = "string"

对于 SharedImage,请使用:

  type = "SharedImage"
  galleryImageId = "string"
  replicationRegions = [
    "string"
  ]

对于 VHD,请使用:

  type = "VHD"

ImageTemplateSource 对象

设置 type 属性以指定对象的类型。

对于 ISO,请使用:

  type = "ISO"
  sha256Checksum = "string"
  sourceURI = "string"

对于 ManagedImage,请使用:

  type = "ManagedImage"
  imageId = "string"

对于 PlatformImage,请使用:

  type = "PlatformImage"
  offer = "string"
  publisher = "string"
  sku = "string"
  version = "string"

属性值

imageTemplates

名称 说明 Value
type 资源类型 “Microsoft.VirtualMachineImages/imageTemplates@2019-02-01-preview”
name 资源名称 字符串 (必需)
location 资源位置 字符串 (必需)
parent_id 若要部署到资源组,请使用该资源组的 ID。 字符串 (必需)
标记 资源标记 标记名称和值的字典。
properties ImageTemplateProperties

ImageTemplateProperties

名称 说明
自定义 指定用于描述映像的自定义步骤的属性,如图像源等 ImageTemplateCustomizer[]
分发 (distribute) 映像输出需要转到的分发目标。 ImageTemplateDistributor[] (必需)
source 指定用于描述源图像的属性。 ImageTemplateSource (必需)

ImageTemplateCustomizer

名称 说明
name 友好名称,提供有关此自定义步骤的用途的上下文 string
type 设置对象类型 PowerShell
Shell
WindowsRestart (必需)

ImageTemplatePowerShellCustomizer

名称 说明 Value
type 要在映像上使用的自定义工具的类型。 例如,“Shell”可以是 shell 定制器 需要“PowerShell” ()
inline 要执行的 PowerShell 命令数组 string[]
脚本 要运行用于自定义的 PowerShell 脚本。 它可以是 github 链接、Azure 存储的 SAS URI 等 string
validExitCodes PowerShell 脚本的有效退出代码。 [默认值:0] int[]

ImageTemplateShellCustomizer

名称 说明 Value
type 要在映像上使用的自定义工具的类型。 例如,“Shell”可以是 shell 定制器 “Shell” (必需)
inline 要执行的 shell 命令数组 string[]
脚本 要运行用于自定义的 shell 脚本。 它可以是 github 链接、Azure 存储的 SAS URI 等 string

ImageTemplateRestartCustomizer

名称 说明 Value
type 要在映像上使用的自定义工具的类型。 例如,“Shell”可以是 shell 定制器 需要“WindowsRestart” ()
restartCheckCommand 重启成功时检查命令 [默认值:''] 字符串
restartCommand 用于执行重启的命令 [默认值:'shutdown /r /f /t 0 /c “packer restart”'] 字符串
restartTimeout 指定为数量级和单位字符串的重启超时,例如“5m” (5 分钟) 或“2h” (2 小时) [默认值:'5m'] 字符串

ImageTemplateDistributor

名称 说明
artifactTags 分发服务器创建/更新项目后将应用于项目的标记。 对象 (object)
runOutputName 要用于关联的 RunOutput 的名称。 字符串 (必需)
类型 设置对象类型 ManagedImage
SharedImage
需要 VHD ()

ImageTemplateManagedImageDistributor

名称 说明 Value
type 分发类型。 “ManagedImage” (需要)
imageId 托管磁盘映像的资源 ID 字符串 (必需)
location 映像的 Azure 位置(如果映像已存在)应匹配 字符串 (必需)

ImageTemplateSharedImageDistributor

名称 说明 Value
type 分发类型。 需要“SharedImage” ()
galleryImageId 共享映像库映像的资源 ID 字符串 (必需)
replicationRegions string[] (必需)

ImageTemplateVhdDistributor

名称 说明 Value
type 分发类型。 需要“VHD” ()

ImageTemplateSource

名称 说明 Value
type 设置对象类型 ISO
ManagedImage
PlatformImage (必需)

ImageTemplateIsoSource

名称 说明 Value
type 指定要开始使用的源映像的类型。 “ISO” (必需)
sha256Checksum ISO 映像的 SHA256 校验和。 字符串 (必需)
sourceURI 用于获取 ISO 映像的 URI。 创建映像模板时,资源提供程序必须可访问此 URI。 字符串 (必需)

ImageTemplateManagedImageSource

名称 说明 Value
type 指定要开始使用的源映像的类型。 “ManagedImage” (需要)
imageId 客户订阅中托管映像的 ARM 资源 ID 字符串 (必需)

ImageTemplatePlatformImageSource

名称 说明 Value
type 指定要开始使用的源映像的类型。 “PlatformImage” (必需)
offer Azure 库映像中的映像产品/服务。 字符串
发布者 Azure 库映像中的映像发布者。 字符串
sku Azure 库映像中的映像 SKU。 string
版本 Azure 库映像中的映像版本。 字符串