Microsoft.VirtualMachineImages imageTemplates
Bicep 資源定義
imageTemplates 資源類型可以部署到:
- 資源群組 - 請參閱 資源群組部署命令
如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。
資源格式
若要建立 Microsoft.VirtualMachineImages/imageTemplates 資源,請將下列 Bicep 新增至範本。
resource symbolicname 'Microsoft.VirtualMachineImages/imageTemplates@2022-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
}
stagingResourceGroup: 'string'
validate: {
continueDistributeOnFailure: bool
inVMValidations: [
{
name: 'string'
type: 'string'
// For remaining properties, see ImageTemplateInVMValidator objects
}
]
sourceValidationOnly: bool
}
vmProfile: {
osDiskSizeGB: int
userAssignedIdentities: [
'string'
]
vmSize: 'string'
vnetConfig: {
proxyVmSize: 'string'
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'
ImageTemplateInVMValidator 物件
設定 type 屬性以指定物件的類型。
針對 PowerShell,請使用:
type: 'PowerShell'
inline: [
'string'
]
runAsSystem: bool
runElevated: bool
scriptUri: 'string'
sha256Checksum: 'string'
validExitCodes: [
int
]
針對 Shell,請使用:
type: 'Shell'
inline: [
'string'
]
scriptUri: 'string'
sha256Checksum: '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 (必要) |
stagingResourceGroup | 與將用來建置映像之映像範本相同訂用帳戶中的暫存資源群組標識碼。 如果此欄位是空的,將會建立具有隨機名稱的資源群組。 如果此欄位中指定的資源群組不存在,則會使用相同的名稱建立。 如果指定的資源群組存在,它必須是空的,且位於與映像範本相同的區域中。 如果此欄位是空的,或指定的資源群組不存在,則會在範本刪除期間刪除所建立的資源群組,但如果指定的資源群組存在,則會在範本刪除期間刪除資源群組,而且資源群組本身將會保留。 | 字串 |
validate | 要對產生的映像執行之驗證的組態選項和清單。 | ImageTemplatePropertiesValidate |
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',則會在映射組建發生時評估版本,而不是提交範本時。 | 字串 |
PlatformImagePurchasePlan
名稱 | 描述 | 值 |
---|---|---|
planName | 購買方案的名稱。 | 字串 (必要) |
planProduct | 購買方案的產品。 | 字串 (必要) |
planPublisher | 購買方案的發行者。 | 字串 (必要) |
ImageTemplateSharedImageVersionSource
名稱 | 描述 | 值 |
---|---|---|
類型 | 指定您想要開頭的來源影像類型。 | 'SharedImageVersion' (必要) |
imageVersionId | 共用映像庫中映像版本的 ARM 資源識別碼 | 字串 (必要) |
ImageTemplatePropertiesValidate
名稱 | 描述 | 值 |
---|---|---|
continueDistributeOnFailure | 如果驗證失敗,且此字段設定為 false,則不會散發輸出影像 (s) 。 這是預設行為。 如果驗證失敗,且此字段設定為 true,則仍會散發輸出影像 () 。 請謹慎使用此選項,因為它可能會導致散發不正確的影像以供使用。 在任一情況下 (true 或 false) ,當驗證失敗時,將會回報端對端映射執行失敗。 [注意:如果驗證成功,此字段就沒有任何作用。] | bool |
inVMValidations | 要執行的驗證清單。 | ImageTemplateInVMValidator[] |
sourceValidationOnly | 如果此欄位設定為 true,則會直接驗證 'source' 區段中指定的影像。 不會執行個別的組建來產生並驗證自訂映像。 | bool |
ImageTemplateInVMValidator
名稱 | 描述 | 值 |
---|---|---|
NAME | 易記名稱,提供此驗證步驟的內容 | 字串 |
type | 設定物件類型 | PowerShell 需要殼 層 () |
ImageTemplatePowerShellValidator
名稱 | 描述 | 值 |
---|---|---|
類型 | 您想要在 Image 上使用的驗證類型。 例如,“Shell” 可以是殼層驗證 | 需要 『PowerShell』 () |
inline | 要執行的PowerShell命令陣列 | string[] |
runAsSystem | 如果指定,PowerShell 腳本將使用本機系統使用者提高的許可權來執行。 只有在上述 runElevated 字段設定為 true 時,才能為 true。 | bool |
runElevated | 如果指定,PowerShell 腳本將會以提高的許可權執行 | bool |
scriptUri | 要執行以進行驗證的PowerShell腳本 URI。 它可以是 github 連結、Azure 記憶體 URI 等 | 字串 |
sha256Checksum | 上述 scriptUri 字段中提供的 Power Shell 腳本 SHA256 總和檢查碼 | 字串 |
validExitCodes | PowerShell 腳本的有效結束代碼。 [預設值: 0] | int[] |
ImageTemplateShellValidator
名稱 | 描述 | 值 |
---|---|---|
類型 | 您想要在影像上使用的驗證類型。 例如,“Shell” 可以是殼層驗證 | 需要 『Shell』 () |
inline | 要執行的殼層命令陣列 | string[] |
scriptUri | 要執行以進行驗證之殼層腳本的 URI。 它可以是 github 連結、Azure 記憶體 URI 等 | 字串 |
sha256Checksum | scriptUri 字段中提供的殼層腳本 SHA256 總和檢查碼 | 字串 |
ImageTemplateVmProfile
名稱 | 描述 | 值 |
---|---|---|
osDiskSizeGB | 以 GB 為單位的 OS 磁碟大小。 省略或指定 0 以使用 Azure 的預設 OS 磁碟大小。 | int |
userAssignedIdentities | 要在組建 VM 和驗證 VM 上設定之使用者指派受控識別的資源識別碼選擇性數位。 這可能包括映像範本的身分識別。 | string[] |
vmSize | 用來建置、自定義和擷取映像的虛擬機大小。 省略或指定空字串,以針對 Gen1 映像使用預設 (Standard_D1_v2,並針對 gen2 映像) Standard_D2ds_v4。 | 字串 |
vnetConfig | 要用來部署組建 VM 和驗證 VM 的虛擬網路選擇性設定。 如果不需要使用特定虛擬網路,則省略。 | VirtualNetworkConfig |
VirtualNetworkConfig
名稱 | 描述 | 值 |
---|---|---|
proxyVmSize | 用來將流量傳遞至組建 VM 和驗證 VM 的 Proxy 虛擬機大小。 省略或指定空字串以使用預設 (Standard_A1_v2) 。 | 字串 |
subnetId | 預先存在的子網資源標識碼。 | 字串 |
快速入門範本
下列快速入門範本會部署此資源類型。
範本 | 描述 |
---|---|
使用 Azure Windows 基準的 Azure Image Builder |
建立 Azure Image Builder 環境,並建置 Windows Server 映射,並套用最新的 Windows 匯報 和 Azure Windows 基準。 |
設定開發箱服務 |
此範本會根據 Dev Box 快速入門指南建立所有 Dev Box 系統管理員資源。 您可以檢視所有已建立的資源,或直接移至 DevPortal.microsoft.com 以建立您的第一個 Dev Box。 |
ARM 範本資源定義
imageTemplates 資源類型可以部署到:
- 資源群組 - 請參閱 資源群組部署命令
如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。
資源格式
若要建立 Microsoft.VirtualMachineImages/imageTemplates 資源,請將下列 JSON 新增至範本。
{
"type": "Microsoft.VirtualMachineImages/imageTemplates",
"apiVersion": "2022-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
},
"stagingResourceGroup": "string",
"validate": {
"continueDistributeOnFailure": "bool",
"inVMValidations": [
{
"name": "string",
"type": "string"
// For remaining properties, see ImageTemplateInVMValidator objects
}
],
"sourceValidationOnly": "bool"
},
"vmProfile": {
"osDiskSizeGB": "int",
"userAssignedIdentities": [ "string" ],
"vmSize": "string",
"vnetConfig": {
"proxyVmSize": "string",
"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"
ImageTemplateInVMValidator 物件
設定 type 屬性以指定物件的類型。
針對 PowerShell,請使用:
"type": "PowerShell",
"inline": [ "string" ],
"runAsSystem": "bool",
"runElevated": "bool",
"scriptUri": "string",
"sha256Checksum": "string",
"validExitCodes": [ "int" ]
針對 Shell,請使用:
"type": "Shell",
"inline": [ "string" ],
"scriptUri": "string",
"sha256Checksum": "string"
屬性值
imageTemplates
名稱 | 描述 | 值 |
---|---|---|
類型 | 資源類型 | 'Microsoft.VirtualMachineImages/imageTemplates' |
apiVersion | 資源 API 版本 | '2022-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 (必要) |
stagingResourceGroup | 與將用來建置映像之映像範本相同訂用帳戶中的預備資源群組標識碼。 如果此欄位是空的,將會建立具有隨機名稱的資源群組。 如果此欄位中指定的資源群組不存在,則會使用相同的名稱建立。 如果指定的資源群組存在,它必須是空的,且位於與映像範本相同的區域中。 如果此欄位是空的,或指定的資源群組不存在,則會在範本刪除期間刪除建立的資源群組,但如果指定的資源群組存在,則會在範本刪除期間刪除資源群組,而資源群組本身將維持不變。 | 字串 |
validate | 要對產生的映像執行的組態選項和驗證清單。 | ImageTemplatePropertiesValidate |
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',則會在映射組建發生時評估版本,而不是提交範本時。 | 字串 |
PlatformImagePurchasePlan
名稱 | 描述 | 值 |
---|---|---|
planName | 購買方案的名稱。 | 字串 (必要) |
planProduct | 購買方案的產品。 | 字串 (必要) |
planPublisher | 購買方案的發行者。 | 字串 (必要) |
ImageTemplateSharedImageVersionSource
名稱 | 描述 | 值 |
---|---|---|
類型 | 指定您想要開頭的來源影像類型。 | 'SharedImageVersion' (必要) |
imageVersionId | 共用映像庫中映像版本的 ARM 資源識別碼 | 字串 (必要) |
ImageTemplatePropertiesValidate
名稱 | 描述 | 值 |
---|---|---|
continueDistributeOnFailure | 如果驗證失敗,且此字段設定為 false,則不會散發輸出影像 (s) 。 這是預設行為。 如果驗證失敗,且此字段設定為 true,則仍會散發輸出影像 () 。 請謹慎使用此選項,因為它可能會導致散發不正確的影像以供使用。 在任一情況下 (true 或 false) ,當驗證失敗時,將會回報端對端映射執行失敗。 [注意:如果驗證成功,此字段就沒有任何作用。] | bool |
inVMValidations | 要執行的驗證清單。 | ImageTemplateInVMValidator[] |
sourceValidationOnly | 如果此欄位設定為 true,則會直接驗證 'source' 區段中指定的影像。 不會執行個別的組建來產生並驗證自訂映像。 | bool |
ImageTemplateInVMValidator
名稱 | 描述 | 值 |
---|---|---|
NAME | 易記名稱,提供此驗證步驟的內容 | 字串 |
type | 設定物件類型 | PowerShell 需要殼 層 () |
ImageTemplatePowerShellValidator
名稱 | 描述 | 值 |
---|---|---|
類型 | 您想要在 Image 上使用的驗證類型。 例如,“Shell” 可以是殼層驗證 | 需要 『PowerShell』 () |
inline | 要執行的PowerShell命令陣列 | string[] |
runAsSystem | 如果指定,PowerShell 腳本將使用本機系統使用者提高的許可權來執行。 只有在上述 runElevated 字段設定為 true 時,才能為 true。 | bool |
runElevated | 如果指定,PowerShell 腳本將會以提高的許可權執行 | bool |
scriptUri | 要執行以進行驗證的PowerShell腳本 URI。 它可以是 github 連結、Azure 記憶體 URI 等 | 字串 |
sha256Checksum | 上述 scriptUri 字段中提供的 Power Shell 腳本 SHA256 總和檢查碼 | 字串 |
validExitCodes | PowerShell 腳本的有效結束代碼。 [預設值: 0] | int[] |
ImageTemplateShellValidator
名稱 | 描述 | 值 |
---|---|---|
類型 | 您想要在 Image 上使用的驗證類型。 例如,“Shell” 可以是殼層驗證 | 需要 『Shell』 () |
inline | 要執行的殼層命令陣列 | string[] |
scriptUri | 要執行以進行驗證的殼層腳本 URI。 它可以是 github 連結、Azure 記憶體 URI 等 | 字串 |
sha256Checksum | scriptUri 字段中提供的殼層腳本 SHA256 總和檢查碼 | 字串 |
ImageTemplateVmProfile
名稱 | 描述 | 值 |
---|---|---|
osDiskSizeGB | 以 GB 為單位的 OS 磁碟大小。 省略或指定 0 以使用 Azure 的預設 OS 磁碟大小。 | int |
userAssignedIdentities | 要在組建 VM 和驗證 VM 上設定之使用者指派受控識別的資源識別碼選擇性數位。 這可能包括映像範本的身分識別。 | string[] |
vmSize | 用來建置、自定義和擷取映像的虛擬機大小。 省略或指定空字串,以針對 Gen1 映像使用預設 (Standard_D1_v2,並針對 Gen2 映射指定Standard_D2ds_v4) 。 | 字串 |
vnetConfig | 要用來部署組建 VM 和驗證 VM 的虛擬網路選擇性設定。 如果不需要使用特定虛擬網路,則省略。 | VirtualNetworkConfig |
VirtualNetworkConfig
名稱 | 描述 | 值 |
---|---|---|
proxyVmSize | 用來將流量傳遞至組建 VM 和驗證 VM 的 Proxy 虛擬機大小。 省略或指定空字串以使用預設 (Standard_A1_v2) 。 | 字串 |
subnetId | 預先存在的子網資源標識碼。 | 字串 |
快速入門範本
下列快速入門範本會部署此資源類型。
範本 | 描述 |
---|---|
使用 Azure Windows 基準的 Azure Image Builder |
建立 Azure Image Builder 環境,並建置已套用最新 Windows 匯報 和 Azure Windows 基準的 Windows Server 映射。 |
設定開發箱服務 |
此範本會根據 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@2022-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
}
stagingResourceGroup = "string"
validate = {
continueDistributeOnFailure = bool
inVMValidations = [
{
name = "string"
type = "string"
// For remaining properties, see ImageTemplateInVMValidator objects
}
]
sourceValidationOnly = bool
}
vmProfile = {
osDiskSizeGB = int
userAssignedIdentities = [
"string"
]
vmSize = "string"
vnetConfig = {
proxyVmSize = "string"
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"
ImageTemplateInVMValidator 物件
設定 type 屬性以指定物件的類型。
針對 PowerShell,請使用:
type = "PowerShell"
inline = [
"string"
]
runAsSystem = bool
runElevated = bool
scriptUri = "string"
sha256Checksum = "string"
validExitCodes = [
int
]
針對 Shell,請使用:
type = "Shell"
inline = [
"string"
]
scriptUri = "string"
sha256Checksum = "string"
屬性值
imageTemplates
名稱 | 描述 | 值 |
---|---|---|
類型 | 資源類型 | “Microsoft.VirtualMachineImages/imageTemplates@2022-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 (必要) |
stagingResourceGroup | 與將用來建置映像之映像範本相同訂用帳戶中的暫存資源群組標識碼。 如果此欄位是空的,將會建立具有隨機名稱的資源群組。 如果此欄位中指定的資源群組不存在,則會使用相同的名稱建立。 如果指定的資源群組存在,它必須是空的,且位於與映像範本相同的區域中。 如果此欄位是空的,或指定的資源群組不存在,則會在範本刪除期間刪除所建立的資源群組,但如果指定的資源群組存在,則會在範本刪除期間刪除資源群組,而且資源群組本身將會保留。 | 字串 |
validate | 要對產生的映像執行之驗證的組態選項和清單。 | ImageTemplatePropertiesValidate |
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',則會在映射組建發生時評估版本,而不是提交範本時評估。 | 字串 |
PlatformImagePurchasePlan
名稱 | 描述 | 值 |
---|---|---|
planName | 購買方案的名稱。 | 需要字串 () |
planProduct | 購買方案的產品。 | 需要字串 () |
planPublisher | 購買方案的發行者。 | 需要字串 () |
ImageTemplateSharedImageVersionSource
名稱 | 描述 | 值 |
---|---|---|
類型 | 指定您想要開頭的來源影像類型。 | “SharedImageVersion” (必要) |
imageVersionId | 共用映像資源庫中映像版本的 ARM 資源識別碼 | 需要字串 () |
ImageTemplatePropertiesValidate
名稱 | 描述 | 值 |
---|---|---|
continueDistributeOnFailure | 如果驗證失敗,且此字段設定為 false,則不會散發輸出影像 () 。 這是預設行為。 如果驗證失敗,且此字段設定為 true,則仍會散發輸出影像 () 。 請謹慎使用此選項,因為它可能會導致散發不正確的影像以供使用。 不論是 (為 true 或 false) ,就會回報端對端映像執行,因為驗證失敗時發生失敗。 [注意:如果驗證成功,此字段沒有任何作用。] | bool |
inVMValidations | 要執行的驗證清單。 | ImageTemplateInVMValidator[] |
sourceValidationOnly | 如果此欄位設定為 true,則會直接驗證 'source' 區段中指定的影像。 不會執行個別的組建來產生並驗證自訂映像。 | bool |
ImageTemplateInVMValidator
名稱 | 描述 | 值 |
---|---|---|
NAME | 易記名稱,以提供此驗證步驟所執行內容的內容 | 字串 |
type | 設定物件類型 | PowerShell 需要殼層 () |
ImageTemplatePowerShellValidator
名稱 | 描述 | 值 |
---|---|---|
類型 | 您想要在影像上使用的驗證類型。 例如,“Shell” 可以是殼層驗證 | “PowerShell” (必要) |
inline | 要執行的PowerShell命令陣列 | string[] |
runAsSystem | 如果指定,PowerShell 腳本將會使用本機系統使用者,以提升的許可權來執行。 只有當上述 runElevated 字段設定為 true 時,才能為 true。 | bool |
runElevated | 如果指定,PowerShell 腳本將會以較高的許可權執行 | bool |
scriptUri | 要執行以進行驗證的PowerShell腳本 URI。 它可以是 github 連結、Azure 記憶體 URI 等 | 字串 |
sha256Checksum | 上述 scriptUri 字段中提供的 Power Shell 腳本 SHA256 總和檢查碼 | 字串 |
validExitCodes | PowerShell 腳本的有效結束代碼。 [預設值: 0] | int[] |
ImageTemplateShellValidator
名稱 | 描述 | 值 |
---|---|---|
類型 | 您想要在 Image 上使用的驗證類型。 例如,“Shell” 可以是殼層驗證 | 「殼層」 (必要) |
inline | 要執行的殼層命令陣列 | string[] |
scriptUri | 要執行以進行驗證的殼層腳本 URI。 它可以是 github 連結、Azure 記憶體 URI 等 | 字串 |
sha256Checksum | scriptUri 字段中提供的殼層腳本 SHA256 總和檢查碼 | 字串 |
ImageTemplateVmProfile
名稱 | 描述 | 值 |
---|---|---|
osDiskSizeGB | 以 GB 為單位的 OS 磁碟大小。 省略或指定 0 以使用 Azure 的預設 OS 磁碟大小。 | int |
userAssignedIdentities | 要在組建 VM 和驗證 VM 上設定之使用者指派受控識別的資源識別碼選擇性數位。 這可能包括映像範本的身分識別。 | string[] |
vmSize | 用來建置、自定義和擷取映像的虛擬機大小。 省略或指定空字串,以針對 Gen1 映像使用預設 (Standard_D1_v2,並針對 Gen2 映射指定Standard_D2ds_v4) 。 | 字串 |
vnetConfig | 要用來部署組建 VM 和驗證 VM 的虛擬網路選擇性設定。 如果不需要使用特定虛擬網路,則省略。 | VirtualNetworkConfig |
VirtualNetworkConfig
名稱 | 描述 | 值 |
---|---|---|
proxyVmSize | 用來將流量傳遞至組建 VM 和驗證 VM 的 Proxy 虛擬機大小。 省略或指定空字串以使用預設 (Standard_A1_v2) 。 | 字串 |
subnetId | 預先存在的子網資源標識碼。 | 字串 |