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

Microsoft.VirtualMachineImages imageTemplates 2019-05-01-preview

Bicep 资源定义

imageTemplates 资源类型可以部署到:

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

资源格式

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

resource symbolicname 'Microsoft.VirtualMachineImages/imageTemplates@2019-05-01-preview' = {
  name: 'string'
  location: 'string'
  tags: {
    tagName1: 'tagValue1'
    tagName2: 'tagValue2'
  }
  identity: {
    type: 'string'
    userAssignedIdentities: {}
  }
  properties: {
    buildTimeoutInMinutes: int
    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
    }
    vmProfile: {
      vmSize: 'string'
    }
  }
}

ImageTemplateCustomizer 对象

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

对于 “文件”,请使用:

  type: 'File'
  destination: 'string'
  sha256Checksum: 'string'
  sourceUri: 'string'

对于 PowerShell,请使用:

  type: 'PowerShell'
  inline: [
    'string'
  ]
  runElevated: bool
  scriptUri: 'string'
  sha256Checksum: 'string'
  validExitCodes: [
    int
  ]

对于 Shell,请使用:

  type: 'Shell'
  inline: [
    'string'
  ]
  scriptUri: 'string'
  sha256Checksum: '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'

对于 SharedImageVersion,请使用:

  type: 'SharedImageVersion'
  imageVersionId: 'string'

属性值

imageTemplates

名称 说明
name 资源名称 字符串 (必需)
location 资源位置 字符串 (必需)
标记 资源标记 标记名称和值的字典。 请参阅 模板中的标记
标识 映像模板的标识(如果已配置)。 ImageTemplateIdentity
properties 映像模板的属性 ImageTemplateProperties

ImageTemplateIdentity

名称 说明 Value
type 用于映像模板的标识类型。 类型“None”将从映像模板中删除任何标识。 “None”
“UserAssigned”
userAssignedIdentities 与映像模板关联的用户标识列表。 用户标识字典键引用将是 ARM 资源 ID,格式为:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。 对象 (object)

ImageTemplateProperties

名称 说明
buildTimeoutInMinutes 生成映像模板时要等待的最大持续时间。 省略或指定 0 以使用默认 (4 小时) 。 int
自定义 指定用于描述映像的自定义步骤的属性,如图像源等 ImageTemplateCustomizer[]
分发 (distribute) 映像输出需要转到的分发目标。 ImageTemplateDistributor[] (必需)
source 指定用于描述源图像的属性。 ImageTemplateSource (必需)
vmProfile 介绍如何设置虚拟机以生成映像 ImageTemplateVmProfile

ImageTemplateCustomizer

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

ImageTemplateFileCustomizer

名称 说明 Value
type 要在映像上使用的自定义工具的类型。 例如,“Shell”可以是 shell 定制器 “File” (必需)
destination 文件 (的绝对路径,其中包含已创建的嵌套目录结构) , (sourceUri) 的文件将上传到 VM 中 字符串
sha256Checksum 上述 sourceUri 字段中提供的文件的 SHA256 校验和 字符串
sourceUri 要上传用于自定义 VM 的文件的 URI。 它可以是 github 链接、Azure 存储的 SAS URI 等 string

ImageTemplatePowerShellCustomizer

名称 说明 Value
type 要在映像上使用的自定义工具的类型。 例如,“Shell”可以是 shell 定制器 需要“PowerShell” ()
inline 要执行的 PowerShell 命令数组 string[]
runElevated 如果指定,将使用提升的权限运行 PowerShell 脚本 bool
scriptUri 要运行用于自定义的 PowerShell 脚本的 URI。 它可以是 github 链接、Azure 存储的 SAS URI 等 string
sha256Checksum 上述 scriptUri 字段中提供的 power shell 脚本的 SHA256 校验和 字符串
validExitCodes PowerShell 脚本的有效退出代码。 [默认值:0] int[]

ImageTemplateShellCustomizer

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

ImageTemplateRestartCustomizer

名称 说明 Value
type 要在映像上使用的自定义工具的类型。 例如,“Shell”可以是 shell 定制器 “WindowsRestart” (必需)
restartCheckCommand 重启成功时检查命令 [默认值:''] 字符串
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
需要 SharedImageVersion ()

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 库映像中的映像版本。 string

ImageTemplateSharedImageVersionSource

名称 说明 Value
type 指定要从头开始使用的源图像的类型。 需要“SharedImageVersion” ()
imageVersionId 共享映像库中映像版本的 ARM 资源 ID 字符串 (必需)

ImageTemplateVmProfile

名称 说明
vmSize 用于生成、自定义和捕获映像的虚拟机的大小。 省略或指定空字符串以使用默认 (Standard_D1_v2) 。 string

快速入门模板

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

模板 说明
使用 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-05-01-preview",
  "name": "string",
  "location": "string",
  "tags": {
    "tagName1": "tagValue1",
    "tagName2": "tagValue2"
  },
  "identity": {
    "type": "string",
    "userAssignedIdentities": {}
  },
  "properties": {
    "buildTimeoutInMinutes": "int",
    "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
    },
    "vmProfile": {
      "vmSize": "string"
    }
  }
}

ImageTemplateCustomizer 对象

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

对于 “文件”,请使用:

  "type": "File",
  "destination": "string",
  "sha256Checksum": "string",
  "sourceUri": "string"

对于 PowerShell,请使用:

  "type": "PowerShell",
  "inline": [ "string" ],
  "runElevated": "bool",
  "scriptUri": "string",
  "sha256Checksum": "string",
  "validExitCodes": [ "int" ]

对于 Shell,请使用:

  "type": "Shell",
  "inline": [ "string" ],
  "scriptUri": "string",
  "sha256Checksum": "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"

对于 SharedImageVersion,请使用:

  "type": "SharedImageVersion",
  "imageVersionId": "string"

属性值

imageTemplates

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

ImageTemplateIdentity

名称 说明 Value
type 用于映像模板的标识类型。 类型“None”将从映像模板中删除任何标识。 “None”
“UserAssigned”
userAssignedIdentities 与映像模板关联的用户标识列表。 用户标识字典密钥引用将是 ARM 资源 ID,格式为:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。 对象 (object)

ImageTemplateProperties

名称 说明
buildTimeoutInMinutes 生成映像模板时要等待的最长持续时间。 省略或指定 0 以使用默认 (4 小时) 。 int
自定义 指定用于描述图像的自定义步骤的属性,如图像源等 ImageTemplateCustomizer[]
分发 (distribute) 映像输出需要转到的分发目标。 ImageTemplateDistributor[] (必需的)
source 指定用于描述源图像的属性。 ImageTemplateSource (必需)
vmProfile 介绍如何设置虚拟机以生成映像 ImageTemplateVmProfile

ImageTemplateCustomizer

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

ImageTemplateFileCustomizer

名称 说明 Value
type 要在映像上使用的自定义工具的类型。 例如,“Shell”可以是 shell 定制器 “File” (必需)
destination 文件 (的绝对路径,其中包含已创建的嵌套目录结构) , (sourceUri) 的文件将上传到 VM 中 字符串
sha256Checksum 上述 sourceUri 字段中提供的文件的 SHA256 校验和 字符串
sourceUri 要上传用于自定义 VM 的文件的 URI。 它可以是 github 链接、Azure 存储的 SAS URI 等 字符串

ImageTemplatePowerShellCustomizer

名称 说明 Value
type 要在映像上使用的自定义工具的类型。 例如,“Shell”可以是 shell 定制器 需要“PowerShell” ()
inline 要执行的 PowerShell 命令数组 string[]
runElevated 如果指定,将使用提升的权限运行 PowerShell 脚本 bool
scriptUri 要运行用于自定义的 PowerShell 脚本的 URI。 它可以是 github 链接、Azure 存储的 SAS URI 等 string
sha256Checksum 上述 scriptUri 字段中提供的 power shell 脚本的 SHA256 校验和 字符串
validExitCodes PowerShell 脚本的有效退出代码。 [默认值:0] int[]

ImageTemplateShellCustomizer

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

ImageTemplateRestartCustomizer

名称 说明 Value
type 要在映像上使用的自定义工具的类型。 例如,“Shell”可以是 shell 定制器 “WindowsRestart” (必需)
restartCheckCommand 重启成功时检查命令 [默认值:''] 字符串
restartCommand 用于执行重启的命令 [默认值:'shutdown /r /f /t 0 /c “packer restart”'] 字符串
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
需要 SharedImageVersion ()

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 库映像中的映像版本。 字符串

ImageTemplateSharedImageVersionSource

名称 说明 Value
type 指定要从头开始使用的源图像的类型。 需要“SharedImageVersion” ()
imageVersionId 共享映像库中映像版本的 ARM 资源 ID 字符串 (必需)

ImageTemplateVmProfile

名称 说明
vmSize 用于生成、自定义和捕获映像的虚拟机的大小。 省略或指定空字符串以使用默认 (Standard_D1_v2) 。 字符串

快速入门模板

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

模板 说明
使用 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-05-01-preview"
  name = "string"
  location = "string"
  parent_id = "string"
  tags = {
    tagName1 = "tagValue1"
    tagName2 = "tagValue2"
  }
  identity {
    type =  "UserAssigned"
    identity_ids = []
  }
  body = jsonencode({
    properties = {
      buildTimeoutInMinutes = int
      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
      }
      vmProfile = {
        vmSize = "string"
      }
    }
  })
}

ImageTemplateCustomizer 对象

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

对于 “文件”,请使用:

  type = "File"
  destination = "string"
  sha256Checksum = "string"
  sourceUri = "string"

对于 PowerShell,请使用:

  type = "PowerShell"
  inline = [
    "string"
  ]
  runElevated = bool
  scriptUri = "string"
  sha256Checksum = "string"
  validExitCodes = [
    int
  ]

对于 Shell,请使用:

  type = "Shell"
  inline = [
    "string"
  ]
  scriptUri = "string"
  sha256Checksum = "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"

对于 SharedImageVersion,请使用:

  type = "SharedImageVersion"
  imageVersionId = "string"

属性值

imageTemplates

名称 说明 Value
type 资源类型 “Microsoft.VirtualMachineImages/imageTemplates@2019-05-01-preview”
name 资源名称 字符串 (必需)
location 资源位置 字符串 (必需)
parent_id 若要部署到资源组,请使用该资源组的 ID。 字符串 (必需)
标记 资源标记 标记名称和值的字典。
标识 映像模板的标识(如果已配置)。 ImageTemplateIdentity
properties 映像模板的属性 ImageTemplateProperties

ImageTemplateIdentity

名称 说明 Value
type 用于映像模板的标识类型。 类型“None”将从映像模板中删除任何标识。 “UserAssigned”
identity_ids 与映像模板关联的用户标识列表。 用户标识字典密钥引用将是 ARM 资源 ID,格式为:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。 用户标识 ID 数组。

ImageTemplateProperties

名称 说明
buildTimeoutInMinutes 生成映像模板时要等待的最长持续时间。 省略或指定 0 以使用默认 (4 小时) 。 int
自定义 指定用于描述图像的自定义步骤的属性,如图像源等 ImageTemplateCustomizer[]
分发 (distribute) 映像输出需要转到的分发目标。 ImageTemplateDistributor[] (必需的)
source 指定用于描述源图像的属性。 ImageTemplateSource (必需)
vmProfile 介绍如何设置虚拟机以生成映像 ImageTemplateVmProfile

ImageTemplateCustomizer

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

ImageTemplateFileCustomizer

名称 说明 Value
type 要在映像上使用的自定义工具的类型。 例如,“Shell”可以是 shell 定制器 “文件” (必需)
destination 文件 (的绝对路径,其中包含已创建的嵌套目录结构,) 将从 sourceUri) 中 (的文件上传到 VM 中 字符串
sha256Checksum 上述 sourceUri 字段中提供的文件的 SHA256 校验和 字符串
sourceUri 要上传用于自定义 VM 的文件的 URI。 它可以是 github 链接、Azure 存储的 SAS URI 等 字符串

ImageTemplatePowerShellCustomizer

名称 说明 Value
type 要在映像上使用的自定义工具的类型。 例如,“Shell”可以是 shell 定制器 “PowerShell” (必需)
inline 要执行的 PowerShell 命令数组 string[]
runElevated 如果指定,则 PowerShell 脚本将使用提升的权限运行 bool
scriptUri 要运行用于自定义的 PowerShell 脚本的 URI。 它可以是 github 链接、Azure 存储的 SAS URI 等 string
sha256Checksum 上面的 scriptUri 字段中提供的 power shell 脚本的 SHA256 校验和 字符串
validExitCodes PowerShell 脚本的有效退出代码。 [默认值:0] int[]

ImageTemplateShellCustomizer

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

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
需要 SharedImageVersion ()

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 库映像中的映像发布者。 string
sku Azure 库映像中的映像 SKU。 string
版本 Azure 库映像中的映像版本。 string

ImageTemplateSharedImageVersionSource

名称 说明 Value
type 指定要开始使用的源映像的类型。 “SharedImageVersion” (必需)
imageVersionId 共享映像库中映像版本的 ARM 资源 ID 字符串 (必需)

ImageTemplateVmProfile

名称 说明
vmSize 用于生成、自定义和捕获映像的虚拟机的大小。 省略或指定空字符串以使用默认 (Standard_D1_v2) 。 字符串