共用方式為


Microsoft.VirtualMachineImages imageTemplates 2020-02-14

Bicep 資源定義

imageTemplates 資源類型可以部署到:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄

資源格式

若要建立 Microsoft.VirtualMachineImages/imageTemplates 資源,請將下列 Bicep 新增至您的範本。

resource symbolicname 'Microsoft.VirtualMachineImages/imageTemplates@2020-02-14' = {
  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: {
      osDiskSizeGB: int
      vmSize: 'string'
      vnetConfig: {
        subnetId: 'string'
      }
    }
  }
}

ImageTemplateCustomizer 物件

設定 type 屬性以指定物件的類型。

針對 [檔案],請使用:

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

針對 PowerShell,請使用:

  type: 'PowerShell'
  inline: [
    'string'
  ]
  runAsSystem: bool
  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'

針對 WindowsUpdate,請使用:

  type: 'WindowsUpdate'
  filters: [
    'string'
  ]
  searchCriteria: 'string'
  updateLimit: int

ImageTemplateDistributor 物件

設定 type 屬性以指定物件的類型。

針對 ManagedImage,請使用:

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

針對 SharedImage,請使用:

  type: 'SharedImage'
  excludeFromLatest: bool
  galleryImageId: 'string'
  replicationRegions: [
    'string'
  ]
  storageAccountType: 'string'

針對 VHD,請使用:

  type: 'VHD'

ImageTemplateSource 物件

設定 type 屬性以指定物件的類型。

針對 ManagedImage,請使用:

  type: 'ManagedImage'
  imageId: 'string'

針對 PlatformImage,請使用:

  type: 'PlatformImage'
  offer: 'string'
  planInfo: {
    planName: 'string'
    planProduct: 'string'
    planPublisher: 'string'
  }
  publisher: 'string'
  sku: 'string'
  version: 'string'

針對 SharedImageVersion,請使用:

  type: 'SharedImageVersion'
  imageVersionId: 'string'

屬性值

imageTemplates

名稱 描述
NAME 資源名稱 字串 (必要)
location 資源位置 字串 (必要)
tags 資源標籤 標記名稱和值的字典。 請參閱 範本中的標記
身分識別 如果已設定,映像範本的身分識別。 ImageTemplateIdentity (必要)
properties 映像範本的屬性 ImageTemplateProperties

ImageTemplateIdentity

名稱 描述
類型 用於映像範本的身分識別類型。 類型 『None』 會從映像範本中移除任何身分識別。 'None'
'UserAssigned'
userAssignedIdentities 與映像範本相關聯的使用者身分識別清單。 使用者身分識別字典索引鍵參考的格式為 ARM 資源標識符:'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'。 物件 (object)

ImageTemplateProperties

名稱 描述
buildTimeoutInMinutes 建置映像範本時要等候的最大持續時間。 省略或指定 0 以使用預設 (4 小時) 。 int
自訂 指定用來描述影像自定義步驟的屬性,例如影像來源等 ImageTemplateCustomizer[]
散發 (distribute) 映像輸出必須移至其中的散發目標。 ImageTemplateDistributor[] (必要)
來源 指定用來描述來源影像的屬性。 ImageTemplateSource (必要)
vmProfile 描述如何設定虛擬機以建置映像 ImageTemplateVmProfile

ImageTemplateCustomizer

名稱 描述
NAME 易記名稱,提供此自定義步驟的內容 字串
type 設定物件類型 檔案
PowerShell
Shell
WindowsRestart
需要 WindowsUpdate ()

ImageTemplateFileCustomizer

名稱 描述
類型 您想要在映像上使用的自訂工具類型。 例如,“Shell” 可以是殼層自定義工具 需要 『File』 ()
目的地 已建立巢狀目錄結構的檔案 (絕對路徑,) 來源Uri) 檔案 (上傳至 VM 中 字串
sha256Checksum 上述 sourceUri 字段中提供的檔案 SHA256 總和檢查碼 字串
sourceUri 要上傳以自定義 VM 之檔案的 URI。 它可以是 Github 連結、適用於 Azure 記憶體的 SAS URI 等等 字串

ImageTemplatePowerShellCustomizer

名稱 描述
類型 您想要在映像上使用的自訂工具類型。 例如,“Shell” 可以是殼層自定義工具 需要 『PowerShell』 ()
inline 要執行的PowerShell命令陣列 string[]
runAsSystem 如果指定,PowerShell 腳本將會使用本機系統使用者,以提升的許可權來執行。 只有當上述 runElevated 字段設定為 true 時,才能為 true。 bool
runElevated 如果指定,PowerShell 腳本將會以較高的許可權執行 bool
scriptUri 要執行以進行自定義之 PowerShell 腳本的 URI。 它可以是 Github 連結、適用於 Azure 記憶體的 SAS URI 等等 字串
sha256Checksum 上述 scriptUri 字段中提供的 Power Shell 腳本 SHA256 總和檢查碼 字串
validExitCodes PowerShell 腳本的有效結束代碼。 [預設值: 0] int[]

ImageTemplateShellCustomizer

名稱 描述
類型 您想要在映像上使用的自訂工具類型。 例如,“Shell” 可以是殼層自定義工具 需要 『Shell』 ()
inline 要執行的殼層命令陣列 string[]
scriptUri 要執行以自定義之殼層腳本的 URI。 它可以是 Github 連結、適用於 Azure 記憶體的 SAS URI 等等 字串
sha256Checksum scriptUri 字段中提供的殼層腳本 SHA256 總和檢查碼 字串

ImageTemplateRestartCustomizer

名稱 描述
類型 您想要在映像上使用的自訂工具類型。 例如,“Shell” 可以是殼層自定義工具 'WindowsRestart' (必要)
restartCheckCommand 檢查重新啟動是否成功的命令 [預設: ''] 字串
restartCommand 執行重新啟動的命令 [預設值:'shutdown /r /f /t 0 /c “packer restart”'] 字串
restartTimeout 以大小和單位字串指定的重新啟動逾時,例如 '5m' (5 分鐘) 或 '2h' (2 小時) [預設值:'5m'] 字串

ImageTemplateWindowsUpdateCustomizer

名稱 描述
類型 您想要在映像上使用的自訂工具類型。 例如,“Shell” 可以是殼層自定義工具 需要 『WindowsUpdate』 ()
filters 要選取要套用之更新的篩選陣列。 省略或指定空陣列,以使用預設 (沒有篩選條件) 。 如需此欄位的範例和詳細描述,請參閱上述連結。 string[]
searchCriteria 搜尋更新的準則。 省略或指定空字串,以使用預設 (搜尋所有) 。 如需此欄位的範例和詳細描述,請參閱上述連結。 字串
updateLimit 一次要套用的更新數目上限。 省略或指定 0 以使用預設 (1000) int

ImageTemplateDistributor

名稱 描述
artifactTags 散發者建立/更新成品后,將套用至成品的標記。 物件 (object)
runOutputName 要用於相關聯 RunOutput 的名稱。 字串 (必要)
類型 設定物件類型 ManagedImage
SharedImage
需要 VHD ()

ImageTemplateManagedImageDistributor

名稱 描述
類型 散發類型。 需要 『ManagedImage』 ()
imageId 受控磁碟映像的資源標識碼 字串 (必要)
location 映射的 Azure 位置,如果映射已經存在,則應該符合 字串 (必要)

ImageTemplateSharedImageDistributor

名稱 描述
類型 散發類型。 'SharedImage' (必要)
excludeFromLatest 旗標,指出是否應該從最新排除已建立的映像版本。 省略以使用預設 (false) 。 bool
galleryImageId 共用映像庫 映像的資源標識碼 字串 (必要)
replicationRegions 將複寫映像的區域清單 string[] (必要)
storageAccountType 用來儲存共用映像的記憶體帳戶類型。 省略以使用預設 (Standard_LRS) 。 'Standard_LRS'
'Standard_ZRS'

ImageTemplateVhdDistributor

名稱 描述
類型 散發類型。 需要 『VHD』 ()

ImageTemplateSource

名稱 描述
類型 設定物件類型 ManagedImage
PlatformImage
SharedImageVersion (必要)

ImageTemplateManagedImageSource

名稱 描述
類型 指定您想要開頭的來源影像類型。 需要 『ManagedImage』 ()
imageId 客戶訂用帳戶中受控映像的 ARM 資源識別碼 字串 (必要)

ImageTemplatePlatformImageSource

名稱 描述
類型 指定您想要開頭的來源影像類型。 'PlatformImage' (必要)
供應項目 Azure 資源庫映射的映像供應專案 字串
planInfo 平臺映像的選擇性購買方案設定。 PlatformImagePurchasePlan
publisher Azure 資源庫映射中的映像發行者。 字串
sku Azure 資源庫映射中的映射 SKU。 字串
version Azure 資源庫映射的映射版本。 如果在這裡指定 'latest',則會在映射組建發生時評估版本,而不是提交範本時。 指定 『latest』 可能會導致ROUNDTRIP_INCONSISTENT_PROPERTY將修正的問題。 字串

PlatformImagePurchasePlan

名稱 描述
planName 購買方案的名稱。 字串 (必要)
planProduct 購買方案的產品。 字串 (必要)
planPublisher 購買方案的發行者。 字串 (必要)

ImageTemplateSharedImageVersionSource

名稱 描述
類型 指定您想要開頭的來源影像類型。 'SharedImageVersion' (必要)
imageVersionId 共用映像庫中映像版本的 ARM 資源識別碼 字串 (必要)

ImageTemplateVmProfile

名稱 描述
osDiskSizeGB 以 GB 為單位的 OS 磁碟大小。 省略或指定 0 以使用 Azure 的預設 OS 磁碟大小。 int
vmSize 用來建置、自定義和擷取映像的虛擬機大小。 省略或指定空字串,以針對 Gen1 映像使用預設 (Standard_D1_v2,並針對 Gen2 映射指定Standard_D2ds_v4) 。 字串
vnetConfig 要用來部署組建虛擬機的虛擬網路選擇性設定。 如果不需要使用特定虛擬網路,則省略。 VirtualNetworkConfig

VirtualNetworkConfig

名稱 描述
subnetId 預先存在的子網資源標識碼。 字串

快速入門範本

下列快速入門範本會部署此資源類型。

範本 描述
使用 Azure Windows 基準的 Azure Image Builder

部署至 Azure
建立 Azure Image Builder 環境並建置 Windows Server 映射,並套用最新的 Windows 匯報 和 Azure Windows 基準。
設定開發箱服務

部署至 Azure
此範本會根據 Dev Box 快速入門指南建立所有 Dev Box 系統管理員資源。 您可以檢視所有已建立的資源,或直接移至 DevPortal.microsoft.com,以建立您的第一個開發箱。

ARM 範本資源定義

imageTemplates 資源類型可以部署到:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄

資源格式

若要建立 Microsoft.VirtualMachineImages/imageTemplates 資源,請將下列 JSON 新增至您的範本。

{
  "type": "Microsoft.VirtualMachineImages/imageTemplates",
  "apiVersion": "2020-02-14",
  "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": {
      "osDiskSizeGB": "int",
      "vmSize": "string",
      "vnetConfig": {
        "subnetId": "string"
      }
    }
  }
}

ImageTemplateCustomizer 物件

設定 type 屬性以指定物件的類型。

針對 [檔案],請使用:

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

針對 PowerShell,請使用:

  "type": "PowerShell",
  "inline": [ "string" ],
  "runAsSystem": "bool",
  "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"

針對 WindowsUpdate,請使用:

  "type": "WindowsUpdate",
  "filters": [ "string" ],
  "searchCriteria": "string",
  "updateLimit": "int"

ImageTemplateDistributor 物件

設定 type 屬性以指定物件的類型。

針對 ManagedImage,請使用:

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

針對 SharedImage,請使用:

  "type": "SharedImage",
  "excludeFromLatest": "bool",
  "galleryImageId": "string",
  "replicationRegions": [ "string" ],
  "storageAccountType": "string"

針對 VHD,請使用:

  "type": "VHD"

ImageTemplateSource 物件

設定 type 屬性以指定物件的類型。

針對 ManagedImage,請使用:

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

針對 PlatformImage,請使用:

  "type": "PlatformImage",
  "offer": "string",
  "planInfo": {
    "planName": "string",
    "planProduct": "string",
    "planPublisher": "string"
  },
  "publisher": "string",
  "sku": "string",
  "version": "string"

針對 SharedImageVersion,請使用:

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

屬性值

imageTemplates

名稱 描述
類型 資源類型 'Microsoft.VirtualMachineImages/imageTemplates'
apiVersion 資源 API 版本 '2020-02-14'
NAME 資源名稱 字串 (必要)
location 資源位置 字串 (必要)
tags 資源標籤 標記名稱和值的字典。 請參閱 範本中的標記
身分識別 如果已設定,映像範本的身分識別。 ImageTemplateIdentity (必要)
properties 映像範本的屬性 ImageTemplateProperties

ImageTemplateIdentity

名稱 描述
類型 用於映像範本的身分識別類型。 類型 『None』 會從映像範本中移除任何身分識別。 'None'
'UserAssigned'
userAssignedIdentities 與映像範本相關聯的使用者身分識別清單。 使用者身分識別字典索引鍵參考的格式為 ARM 資源標識符:'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'。 物件 (object)

ImageTemplateProperties

名稱 描述
buildTimeoutInMinutes 建置映像範本時要等候的最大持續時間。 省略或指定 0 以使用預設 (4 小時) 。 int
自訂 指定用來描述影像自定義步驟的屬性,例如影像來源等 ImageTemplateCustomizer[]
散發 (distribute) 映像輸出必須移至其中的散發目標。 ImageTemplateDistributor[] (必要)
來源 指定用來描述來源影像的屬性。 ImageTemplateSource (必要)
vmProfile 描述如何設定虛擬機以建置映像 ImageTemplateVmProfile

ImageTemplateCustomizer

名稱 描述
NAME 易記名稱,提供此自定義步驟的內容 字串
type 設定物件類型 檔案
PowerShell
Shell
WindowsRestart
WindowsUpdate (必要)

ImageTemplateFileCustomizer

名稱 描述
類型 您想要在映像上使用的自訂工具類型。 例如,“Shell” 可以是殼層自定義工具 'File' (必要)
目的地 已建立巢狀目錄結構的檔案 (絕對路徑,) 來源Uri) 檔案 (上傳至 VM 字串
sha256Checksum 上述 sourceUri 字段中提供的檔案 SHA256 總和檢查碼 字串
sourceUri 要上傳以自定義 VM 之檔案的 URI。 它可以是 github 連結、適用於 Azure 記憶體的 SAS URI 等等 字串

ImageTemplatePowerShellCustomizer

名稱 描述
類型 您想要在映像上使用的自訂工具類型。 例如,“Shell” 可以是殼層自定義工具 需要 『PowerShell』 ()
inline 要執行的PowerShell命令陣列 string[]
runAsSystem 如果指定,PowerShell 腳本將使用本機系統使用者提高的許可權來執行。 只有在上述 runElevated 字段設定為 true 時,才能為 true。 bool
runElevated 如果指定,PowerShell 腳本將會以提高的許可權執行 bool
scriptUri 要執行的PowerShell腳本 URI 以進行自定義。 它可以是 github 連結、適用於 Azure 記憶體的 SAS URI 等等 字串
sha256Checksum 上述 scriptUri 字段中提供的 Power Shell 腳本 SHA256 總和檢查碼 字串
validExitCodes PowerShell 腳本的有效結束代碼。 [預設值: 0] int[]

ImageTemplateShellCustomizer

名稱 描述
類型 您想要在映像上使用的自訂工具類型。 例如,“Shell” 可以是殼層自定義工具 需要 『Shell』 ()
inline 要執行的殼層命令陣列 string[]
scriptUri 要執行以自定義之殼層腳本的 URI。 它可以是 Github 連結、適用於 Azure 記憶體的 SAS URI 等等 字串
sha256Checksum scriptUri 字段中提供的殼層腳本 SHA256 總和檢查碼 字串

ImageTemplateRestartCustomizer

名稱 描述
類型 您想要在映像上使用的自訂工具類型。 例如,“Shell” 可以是殼層自定義工具 'WindowsRestart' (必要)
restartCheckCommand 檢查重新啟動是否成功的命令 [預設: ''] 字串
restartCommand 執行重新啟動的命令 [預設值:'shutdown /r /f /t 0 /c “packer restart”'] 字串
restartTimeout 以大小和單位字串指定的重新啟動逾時,例如 '5m' (5 分鐘) 或 '2h' (2 小時) [預設值:'5m'] 字串

ImageTemplateWindowsUpdateCustomizer

名稱 描述
類型 您想要在映像上使用的自訂工具類型。 例如,“Shell” 可以是殼層自定義工具 需要 『WindowsUpdate』 ()
filters 要選取要套用之更新的篩選陣列。 省略或指定空陣列,以使用預設 (沒有篩選條件) 。 如需此欄位的範例和詳細描述,請參閱上述連結。 string[]
searchCriteria 搜尋更新的準則。 省略或指定空字串,以使用預設 (搜尋所有) 。 如需此欄位的範例和詳細描述,請參閱上述連結。 字串
updateLimit 一次要套用的更新數目上限。 省略或指定 0 以使用預設 (1000) int

ImageTemplateDistributor

名稱 描述
artifactTags 散發者建立/更新成品后,將會套用至成品的標記。 物件 (object)
runOutputName 要用於相關聯 RunOutput 的名稱。 需要字串 ()
類型 設定物件類型 ManagedImage
SharedImage
需要 VHD ()

ImageTemplateManagedImageDistributor

名稱 描述
類型 分佈類型。 需要 『ManagedImage』 ()
imageId 受控磁碟映像的資源標識碼 需要字串 ()
location 映射的 Azure 位置,如果映射已存在,則應該符合 需要字串 ()

ImageTemplateSharedImageDistributor

名稱 描述
類型 分佈類型。 'SharedImage' (必要)
excludeFromLatest 旗標,指出是否應該從最新版排除已建立的映像版本。 省略以使用預設 (false) 。 bool
galleryImageId 共用映像庫 映像的資源標識碼 需要字串 ()
replicationRegions 將複寫映像的區域清單 string[] (必要)
storageAccountType 用來儲存共用映像的記憶體帳戶類型。 省略 以使用預設 (Standard_LRS) 。 'Standard_LRS'
'Standard_ZRS'

ImageTemplateVhdDistributor

名稱 描述
類型 分佈類型。 需要 『VHD』 ()

ImageTemplateSource

名稱 描述
類型 設定物件類型 ManagedImage
PlatformImage
需要 SharedImageVersion ()

ImageTemplateManagedImageSource

名稱 描述
類型 指定您想要開頭的來源影像類型。 需要 『ManagedImage』 ()
imageId 客戶訂用帳戶中受控映像的 ARM 資源識別碼 需要字串 ()

ImageTemplatePlatformImageSource

名稱 描述
類型 指定您想要開頭的來源影像類型。 'PlatformImage' (必要)
供應項目 來自 Azure 資源庫映射的映像供應專案 字串
planInfo 平臺映像的選擇性購買方案設定。 PlatformImagePurchasePlan
publisher Azure 資源庫映射中的映像發行者。 字串
sku 來自 Azure 資源庫映像的映像 SKU。 字串
version 來自 Azure 資源庫映像的映像版本。 如果在這裡指定 'latest',則會在映射組建發生時評估版本,而不是提交範本時評估。 指定 『latest』 可能會導致ROUNDTRIP_INCONSISTENT_PROPERTY修正的問題。 字串

PlatformImagePurchasePlan

名稱 描述
planName 購買方案的名稱。 需要字串 ()
planProduct 購買方案的產品。 需要字串 ()
planPublisher 購買方案的發行者。 需要字串 ()

ImageTemplateSharedImageVersionSource

名稱 描述
類型 指定您想要開頭的來源影像類型。 'SharedImageVersion' (必要)
imageVersionId 共用映像資源庫中映像版本的 ARM 資源識別碼 需要字串 ()

ImageTemplateVmProfile

名稱 描述
osDiskSizeGB 以 GB 為單位的 OS 磁碟大小。 省略或指定 0 以使用 Azure 的預設 OS 磁碟大小。 int
vmSize 用來建置、自定義和擷取映像的虛擬機大小。 省略或指定空字串,以針對 Gen1 映像使用預設 (Standard_D1_v2,並針對 gen2 映像) Standard_D2ds_v4。 字串
vnetConfig 要用來部署組建虛擬機的虛擬網路選擇性設定。 如果不需要使用特定虛擬網路,則省略。 VirtualNetworkConfig

VirtualNetworkConfig

名稱 描述
subnetId 預先存在的子網資源標識碼。 字串

快速入門範本

下列快速入門範本會部署此資源類型。

範本 描述
使用 Azure Windows 基準的 Azure Image Builder

部署至 Azure
建立 Azure Image Builder 環境並建置 Windows Server 映射,並套用最新的 Windows 匯報 和 Azure Windows 基準。
設定開發箱服務

部署至 Azure
此範本會根據 Dev Box 快速入門指南建立所有 Dev Box 系統管理員資源。 您可以檢視所有已建立的資源,或直接移至 DevPortal.microsoft.com,以建立您的第一個開發箱。

Terraform (AzAPI 提供者) 資源定義

imageTemplates 資源類型可以部署到:

  • 資源群組

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄

資源格式

若要建立 Microsoft.VirtualMachineImages/imageTemplates 資源,請將下列 Terraform 新增至您的範本。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.VirtualMachineImages/imageTemplates@2020-02-14"
  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 = {
        osDiskSizeGB = int
        vmSize = "string"
        vnetConfig = {
          subnetId = "string"
        }
      }
    }
  })
}

ImageTemplateCustomizer 物件

設定 type 屬性以指定物件的類型。

針對 [檔案],請使用:

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

針對 PowerShell,請使用:

  type = "PowerShell"
  inline = [
    "string"
  ]
  runAsSystem = bool
  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"

針對 WindowsUpdate,請使用:

  type = "WindowsUpdate"
  filters = [
    "string"
  ]
  searchCriteria = "string"
  updateLimit = int

ImageTemplateDistributor 物件

設定 type 屬性以指定物件的類型。

針對 ManagedImage,請使用:

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

針對 SharedImage,請使用:

  type = "SharedImage"
  excludeFromLatest = bool
  galleryImageId = "string"
  replicationRegions = [
    "string"
  ]
  storageAccountType = "string"

針對 VHD,請使用:

  type = "VHD"

ImageTemplateSource 物件

設定 type 屬性以指定物件的類型。

針對 ManagedImage,請使用:

  type = "ManagedImage"
  imageId = "string"

針對 PlatformImage,請使用:

  type = "PlatformImage"
  offer = "string"
  planInfo = {
    planName = "string"
    planProduct = "string"
    planPublisher = "string"
  }
  publisher = "string"
  sku = "string"
  version = "string"

針對 SharedImageVersion,請使用:

  type = "SharedImageVersion"
  imageVersionId = "string"

屬性值

imageTemplates

名稱 描述
類型 資源類型 “Microsoft.VirtualMachineImages/imageTemplates@2020-02-14”
NAME 資源名稱 字串 (必要)
location 資源位置 字串 (必要)
parent_id 若要部署至資源群組,請使用該資源群組的標識碼。 字串 (必要)
tags 資源標籤 標記名稱和值的字典。
身分識別 如果已設定,映像範本的身分識別。 ImageTemplateIdentity (必要)
properties 映像範本的屬性 ImageTemplateProperties

ImageTemplateIdentity

名稱 描述
類型 用於映像範本的身分識別類型。 類型 『None』 會從映像範本中移除任何身分識別。 “UserAssigned”
identity_ids 與映像範本相關聯的使用者身分識別清單。 使用者身分識別字典索引鍵參考的格式為 ARM 資源標識符:'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'。 使用者身分識別標識碼的陣列。

ImageTemplateProperties

名稱 描述
buildTimeoutInMinutes 建置映像範本時要等候的最大持續時間。 省略或指定 0 以使用預設 (4 小時) 。 int
自訂 指定用來描述影像自定義步驟的屬性,例如影像來源等 ImageTemplateCustomizer[]
散發 (distribute) 映像輸出必須移至其中的散發目標。 ImageTemplateDistributor[] (必要)
來源 指定用來描述來源影像的屬性。 ImageTemplateSource (必要)
vmProfile 描述如何設定虛擬機以建置映像 ImageTemplateVmProfile

ImageTemplateCustomizer

名稱 描述
NAME 易記名稱,提供此自定義步驟的內容 字串
type 設定物件類型 檔案
PowerShell
Shell
WindowsRestart
WindowsUpdate (必要)

ImageTemplateFileCustomizer

名稱 描述
類型 您想要在映像上使用的自訂工具類型。 例如,“Shell” 可以是殼層自定義工具 「檔案」 (必要)
目的地 已建立巢狀目錄結構的檔案 (絕對路徑,) 來源Uri) 檔案 (上傳至 VM 字串
sha256Checksum 上述 sourceUri 字段中提供的檔案 SHA256 總和檢查碼 字串
sourceUri 要上傳以自定義 VM 之檔案的 URI。 它可以是 github 連結、適用於 Azure 記憶體的 SAS URI 等等 字串

ImageTemplatePowerShellCustomizer

名稱 描述
類型 您想要在映像上使用的自訂工具類型。 例如,“Shell” 可以是殼層自定義工具 「PowerShell」 (必要)
inline 要執行的PowerShell命令陣列 string[]
runAsSystem 如果指定,PowerShell 腳本將使用本機系統使用者提高的許可權來執行。 只有在上述 runElevated 字段設定為 true 時,才能為 true。 bool
runElevated 如果指定,PowerShell 腳本將會以提高的許可權執行 bool
scriptUri 要執行的PowerShell腳本 URI 以進行自定義。 它可以是 github 連結、適用於 Azure 記憶體的 SAS URI 等等 字串
sha256Checksum 上述 scriptUri 字段中提供的 Power Shell 腳本 SHA256 總和檢查碼 字串
validExitCodes PowerShell 腳本的有效結束代碼。 [預設值: 0] int[]

ImageTemplateShellCustomizer

名稱 描述
類型 您想要在映像上使用的自訂工具類型。 例如,“Shell” 可以是殼層自定義工具 「殼層」 (必要)
inline 要執行的殼層命令陣列 string[]
scriptUri 要執行以進行自定義的殼層腳本 URI。 它可以是 github 連結、適用於 Azure 記憶體的 SAS URI 等等 字串
sha256Checksum scriptUri 字段中提供的殼層腳本 SHA256 總和檢查碼 字串

ImageTemplateRestartCustomizer

名稱 描述
類型 您想要在映像上使用的自訂工具類型。 例如,“Shell” 可以是殼層自定義工具 “WindowsRestart” (必要)
restartCheckCommand 檢查重新啟動是否成功的命令 [預設值: ''] 字串
restartCommand 執行重新啟動的命令 [預設值: 'shutdown /r /f /t 0 /c “packer restart”'] 字串
restartTimeout 指定為大小和單位字串的重新啟動逾時,例如 '5m' (5 分鐘) 或 '2h' (2 小時) [預設值: '5m'] 字串

ImageTemplateWindowsUpdateCustomizer

名稱 描述
類型 您想要在映像上使用的自訂工具類型。 例如,“Shell” 可以是殼層自定義工具 “WindowsUpdate” (必要)
filters 要選取要套用之更新的篩選陣列。 省略或指定空陣列,以使用預設 (沒有篩選條件) 。 如需此欄位的範例和詳細描述,請參閱上述連結。 string[]
searchCriteria 搜尋更新的準則。 省略或指定空字串,以使用預設 (搜尋所有) 。 如需此欄位的範例和詳細描述,請參閱上述連結。 字串
updateLimit 一次要套用的更新數目上限。 省略或指定 0 以使用預設 (1000) int

ImageTemplateDistributor

名稱 描述
artifactTags 散發者建立/更新成品后,將會套用至成品的標記。 物件 (object)
runOutputName 要用於相關聯 RunOutput 的名稱。 需要字串 ()
類型 設定物件類型 ManagedImage
SharedImage
需要 VHD ()

ImageTemplateManagedImageDistributor

名稱 描述
類型 分佈類型。 “ManagedImage” (必要)
imageId 受控磁碟映像的資源標識碼 需要字串 ()
location 映射的 Azure 位置,如果映射已存在,則應該符合 需要字串 ()

ImageTemplateSharedImageDistributor

名稱 描述
類型 分佈類型。 “SharedImage” (必要)
excludeFromLatest 旗標,指出是否應該從最新版排除已建立的映像版本。 省略以使用預設 (false) 。 bool
galleryImageId 共用映像庫 映像的資源標識碼 需要字串 ()
replicationRegions 將複寫映像的區域清單 string[] (必要)
storageAccountType 用來儲存共用映像的記憶體帳戶類型。 省略 以使用預設 (Standard_LRS) 。 "Standard_LRS"
"Standard_ZRS"

ImageTemplateVhdDistributor

名稱 描述
類型 分佈類型。 “VHD” (必要)

ImageTemplateSource

名稱 描述
類型 設定物件類型 ManagedImage
PlatformImage
需要 SharedImageVersion ()

ImageTemplateManagedImageSource

名稱 描述
類型 指定您想要開頭的來源影像類型。 “ManagedImage” (必要)
imageId 客戶訂用帳戶中受控映像的 ARM 資源識別碼 需要字串 ()

ImageTemplatePlatformImageSource

名稱 描述
類型 指定您想要開頭的來源影像類型。 “PlatformImage” (必要)
供應項目 Azure 資源庫映射的映像供應專案 字串
planInfo 平臺映像的選擇性購買方案設定。 PlatformImagePurchasePlan
publisher Azure 資源庫映射中的映像發行者。 字串
sku Azure 資源庫映射中的映射 SKU。 字串
version Azure 資源庫映射的映射版本。 如果在這裡指定 'latest',則會在映射組建發生時評估版本,而不是提交範本時。 指定 『latest』 可能會導致ROUNDTRIP_INCONSISTENT_PROPERTY將修正的問題。 字串

PlatformImagePurchasePlan

名稱 描述
planName 購買方案的名稱。 字串 (必要)
planProduct 購買方案的產品。 字串 (必要)
planPublisher 購買方案的發行者。 字串 (必要)

ImageTemplateSharedImageVersionSource

名稱 描述
類型 指定您想要開頭的來源影像類型。 “SharedImageVersion” (必要)
imageVersionId 共用映像庫中映像版本的 ARM 資源識別碼 字串 (必要)

ImageTemplateVmProfile

名稱 描述
osDiskSizeGB 以 GB 為單位的 OS 磁碟大小。 省略或指定 0 以使用 Azure 的預設 OS 磁碟大小。 int
vmSize 用來建置、自定義和擷取映像的虛擬機大小。 省略或指定空字串,以針對 Gen1 映像使用預設 (Standard_D1_v2,並針對 Gen2 映射指定Standard_D2ds_v4) 。 字串
vnetConfig 要用來部署組建虛擬機的虛擬網路選擇性設定。 如果不需要使用特定虛擬網路,則省略。 VirtualNetworkConfig

VirtualNetworkConfig

名稱 描述
subnetId 預先存在的子網資源標識碼。 字串