共用方式為


Microsoft.Compute 映射 2021-07-01

Bicep 資源定義

映射資源類型可以使用目標作業來部署:

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

資源格式

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

resource symbolicname 'Microsoft.Compute/images@2021-07-01' = {
  name: 'string'
  location: 'string'
  tags: {
    tagName1: 'tagValue1'
    tagName2: 'tagValue2'
  }
  extendedLocation: {
    name: 'string'
    type: 'EdgeZone'
  }
  properties: {
    hyperVGeneration: 'string'
    sourceVirtualMachine: {
      id: 'string'
    }
    storageProfile: {
      dataDisks: [
        {
          blobUri: 'string'
          caching: 'string'
          diskEncryptionSet: {
            id: 'string'
          }
          diskSizeGB: int
          lun: int
          managedDisk: {
            id: 'string'
          }
          snapshot: {
            id: 'string'
          }
          storageAccountType: 'string'
        }
      ]
      osDisk: {
        blobUri: 'string'
        caching: 'string'
        diskEncryptionSet: {
          id: 'string'
        }
        diskSizeGB: int
        managedDisk: {
          id: 'string'
        }
        osState: 'string'
        osType: 'string'
        snapshot: {
          id: 'string'
        }
        storageAccountType: 'string'
      }
      zoneResilient: bool
    }
  }
}

屬性值

images

名稱 描述
NAME 資源名稱 字串 (必要)

字元限制:1-80

合法字元:
英數字元、底線、句號和連字號。

以英數字元開頭。 以英數字元或底線結尾。
location 資源位置 字串 (必要)
tags 資源標籤 標記名稱和值的字典。 請參閱 範本中的標記
extendedLocation Image 的擴充位置。 ExtendedLocation
properties 描述 Image 的屬性。 ImageProperties

ExtendedLocation

名稱 描述
NAME 擴充位置的名稱。 字串
type 擴充位置的類型。 'EdgeZone'

ImageProperties

名稱 描述
hyperVGeneration 指定從映像建立之 VirtualMachine 的 HyperVGenerationType。 如果映射來源是 Blob,則從 API 版本 2019-03-01 開始,我們需要使用者指定值,如果來源是磁碟或快照集等受控資源,我們可能需要使用者指定 屬性,如果我們無法從來源受控資源推斷它。 'V1'
'V2'
sourceVirtualMachine 建立映像的來源虛擬機。 SubResource
storageProfile 指定虛擬機器磁碟的儲存體設定。 ImageStorageProfile

SubResource

名稱 描述
id 資源標識碼 字串

ImageStorageProfile

名稱 描述
dataDisks 指定用來將資料磁碟加入至虛擬機器的參數。

如需磁碟的詳細資訊,請參閱 關於 Azure 虛擬機的磁碟和 VHD
ImageDataDisk[]
osDisk 指定虛擬機所使用的作業系統磁碟相關信息。

如需磁碟的詳細資訊,請參閱 關於 Azure 虛擬機的磁碟和 VHD
ImageOSDisk
zoneResilient 指定映像是否具有區域復原性。 預設值為 false。 區域復原映像只能在提供區域備援記憶體 (ZRS) 的區域建立。 bool

ImageDataDisk

名稱 描述
blobUri 虛擬硬碟。 字串
快取 指定快取需求。

可能的值包括:



ReadOnly

讀寫

預設值: 標準記憶體無。進階記憶體的 ReadOnly
'None'
'ReadOnly'
'ReadWrite'
diskEncryptionSet 指定受控映像磁碟的客戶受控磁碟加密集資源標識碼。 DiskEncryptionSetParameters
diskSizeGB 指定以 GB 為單位的空白資料磁碟大小。 此元素可用來覆寫虛擬機映像中的磁碟名稱。

此值不能大於 1023 GB
int
lun 指定數據磁碟的邏輯單位編號。 此值是用來識別 VM 內的數據磁碟,因此對於連結至 VM 的每個數據磁碟而言,都必須是唯一的。 int (必要)
ManagedDisk managedDisk。 SubResource
快照集 快照集。 SubResource
storageAccountType 指定受控磁碟的記憶體帳戶類型。 注意:UltraSSD_LRS只能與數據磁碟搭配使用,它不能與OS磁碟搭配使用。 'Premium_LRS'
'Premium_ZRS'
'StandardSSD_LRS'
'StandardSSD_ZRS'
'Standard_LRS'
'UltraSSD_LRS'

DiskEncryptionSetParameters

名稱 描述
id 資源標識碼 字串

ImageOSDisk

名稱 描述
blobUri 虛擬硬碟。 字串
快取 指定快取需求。

可能的值包括:



ReadOnly

讀寫

預設值: 標準記憶體無。進階記憶體的 ReadOnly
'None'
'ReadOnly'
'ReadWrite'
diskEncryptionSet 指定受控映像磁碟的客戶受控磁碟加密集資源標識碼。 DiskEncryptionSetParameters
diskSizeGB 指定以 GB 為單位的空白資料磁碟大小。 此元素可用來覆寫虛擬機映像中的磁碟名稱。

此值不能大於 1023 GB
int
ManagedDisk managedDisk。 SubResource
osState OS 狀態。 'Generalized'
必要) (「特製化」
osType 此屬性可讓您指定從自定義映像建立 VM 時,磁碟中包含的 OS 類型。

可能的值包括:

Windows

Linux
'Linux'
'Windows' (必要)
快照集 快照集。 SubResource
storageAccountType 指定受控磁碟的記憶體帳戶類型。 注意:UltraSSD_LRS只能與數據磁碟搭配使用,它不能與OS磁碟搭配使用。 'Premium_LRS'
'Premium_ZRS'
'StandardSSD_LRS'
'StandardSSD_ZRS'
'Standard_LRS'
'UltraSSD_LRS'

快速入門範本

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

範本 描述
從使用者映像建立 VM

部署至 Azure
此範本可讓您從使用者映像建立 虛擬機器。 此範本也會部署 虛擬網路、公用IP位址和網路介面。
從一般化 VHD 在新的或現有的 vnet 中建立 VM

部署至 Azure
此範本會從一般化 VHD 建立 VM,並讓您將其連線到可位於虛擬機另一個資源群組中的新或現有 VNET
使用Linux自定義映像部署VM擴展集

部署至 Azure
此範本可讓您在擴展集內部署自訂 VM Linux 映像。 這些 VM 預設會在埠 80) 上使用 HTTP 負載平衡 (的負載平衡器後方。 此範例會使用自定義腳本來執行應用程式部署和更新,您可能必須為自己的更新程式提供自定義腳本。 您必須在建立 VMSS 的相同訂用帳戶和區域中提供 VM 的一般化映像。
使用 Windows 自定義映射部署 VM 擴展集

部署至 Azure
此範本可讓您部署自訂 Windows 映像的簡單 VM 擴展集。 這些 VM 預設會在埠 80) 上使用 HTTP 負載平衡 (的負載平衡器後方

ARM 範本資源定義

映射資源類型可以使用目標作業來部署:

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

資源格式

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

{
  "type": "Microsoft.Compute/images",
  "apiVersion": "2021-07-01",
  "name": "string",
  "location": "string",
  "tags": {
    "tagName1": "tagValue1",
    "tagName2": "tagValue2"
  },
  "extendedLocation": {
    "name": "string",
    "type": "EdgeZone"
  },
  "properties": {
    "hyperVGeneration": "string",
    "sourceVirtualMachine": {
      "id": "string"
    },
    "storageProfile": {
      "dataDisks": [
        {
          "blobUri": "string",
          "caching": "string",
          "diskEncryptionSet": {
            "id": "string"
          },
          "diskSizeGB": "int",
          "lun": "int",
          "managedDisk": {
            "id": "string"
          },
          "snapshot": {
            "id": "string"
          },
          "storageAccountType": "string"
        }
      ],
      "osDisk": {
        "blobUri": "string",
        "caching": "string",
        "diskEncryptionSet": {
          "id": "string"
        },
        "diskSizeGB": "int",
        "managedDisk": {
          "id": "string"
        },
        "osState": "string",
        "osType": "string",
        "snapshot": {
          "id": "string"
        },
        "storageAccountType": "string"
      },
      "zoneResilient": "bool"
    }
  }
}

屬性值

images

名稱 描述
類型 資源類型 'Microsoft.Compute/images'
apiVersion 資源 API 版本 '2021-07-01'
NAME 資源名稱 字串 (必要)

字元限制:1-80

合法字元:
英數字元、底線、句號和連字號。

以英數字元開頭。 以英數字元或底線結尾。
location 資源位置 字串 (必要)
tags 資源標籤 標記名稱和值的字典。 請參閱 範本中的標記
extendedLocation Image 的擴充位置。 ExtendedLocation
properties 描述 Image 的屬性。 ImageProperties

ExtendedLocation

名稱 描述
NAME 擴充位置的名稱。 字串
type 擴充位置的類型。 'EdgeZone'

ImageProperties

名稱 描述
hyperVGeneration 指定從映像建立之 VirtualMachine 的 HyperVGenerationType。 如果映射來源是 Blob,則從 API 版本 2019-03-01 開始,我們需要使用者指定值,如果來源是磁碟或快照集等受控資源,我們可能需要使用者指定 屬性,如果我們無法從來源受控資源推斷它。 'V1'
'V2'
sourceVirtualMachine 建立映像的來源虛擬機。 SubResource
storageProfile 指定虛擬機器磁碟的儲存體設定。 ImageStorageProfile

SubResource

名稱 描述
id 資源標識碼 字串

ImageStorageProfile

名稱 描述
dataDisks 指定用來將資料磁碟加入至虛擬機器的參數。

如需磁碟的詳細資訊,請參閱 關於 Azure 虛擬機的磁碟和 VHD
ImageDataDisk[]
osDisk 指定虛擬機所使用的作業系統磁碟相關信息。

如需磁碟的詳細資訊,請參閱 關於 Azure 虛擬機的磁碟和 VHD
ImageOSDisk
zoneResilient 指定映像是否具有區域復原能力。 預設值為 false。 區域復原映像只能建立在提供區域備援記憶體 (ZRS) 的區域。 bool

ImageDataDisk

名稱 描述
blobUri 虛擬硬碟。 字串
快取 指定快取需求。

可能的值包括:



ReadOnly

讀寫

預設值: 標準記憶體無。進階記憶體的 ReadOnly
'None'
'ReadOnly'
'ReadWrite'
diskEncryptionSet 指定受控映像磁碟的客戶受控磁碟加密集資源標識碼。 DiskEncryptionSetParameters
diskSizeGB 指定以 GB 為單位的空白資料磁碟大小。 此元素可用來覆寫虛擬機映像中的磁碟名稱。

此值不能大於 1023 GB
int
lun 指定數據磁碟的邏輯單元編號。 這個值是用來識別 VM 內的數據磁碟,因此對於連結至 VM 的每個數據磁碟都必須是唯一的。 需要 int ()
ManagedDisk managedDisk。 SubResource
快照集 快照集。 SubResource
storageAccountType 指定受控磁碟的記憶體帳戶類型。 注意:UltraSSD_LRS只能與數據磁碟搭配使用,因此無法與OS磁碟搭配使用。 'Premium_LRS'
'Premium_ZRS'
'StandardSSD_LRS'
'StandardSSD_ZRS'
'Standard_LRS'
'UltraSSD_LRS'

DiskEncryptionSetParameters

名稱 描述
id 資源標識碼 字串

ImageOSDisk

名稱 描述
blobUri 虛擬硬碟。 字串
快取 指定快取需求。

可能的值包括:



ReadOnly

讀寫

預設值: 標準記憶體無。進階記憶體的 ReadOnly
'None'
'ReadOnly'
'ReadWrite'
diskEncryptionSet 指定受控映像磁碟的客戶受控磁碟加密集資源標識碼。 DiskEncryptionSetParameters
diskSizeGB 指定以 GB 為單位的空白資料磁碟大小。 此元素可用來覆寫虛擬機映像中的磁碟名稱。

此值不能大於 1023 GB
int
ManagedDisk managedDisk。 SubResource
osState OS 狀態。 'Generalized'
「特製化」 (必要)
osType 此屬性可讓您指定從自定義映像建立 VM 時,磁碟中包含的 OS 類型。

可能的值包括:

Windows

Linux
'Linux'
需要 『Windows』 ()
快照集 快照集。 SubResource
storageAccountType 指定受控磁碟的記憶體帳戶類型。 注意:UltraSSD_LRS只能與數據磁碟搭配使用,因此無法與OS磁碟搭配使用。 'Premium_LRS'
'Premium_ZRS'
'StandardSSD_LRS'
'StandardSSD_ZRS'
'Standard_LRS'
'UltraSSD_LRS'

快速入門範本

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

範本 描述
從使用者映像建立 VM

部署至 Azure
此範本可讓您從使用者映像建立 虛擬機器。 此範本也會部署 虛擬網路、公用IP位址和網路介面。
從一般化 VHD 在新的或現有的 vnet 中建立 VM

部署至 Azure
此範本會從一般化 VHD 建立 VM,並讓您將其連線到新的或現有的 VNET,該 VNET 可以位於虛擬機以外的另一個資源群組中
使用Linux自定義映像部署VM擴展集

部署至 Azure
此範本可讓您在擴展集內部署自訂 VM Linux 映像。 根據預設,這些 VM 在埠 80) 上是具有 HTTP 負載平衡 (的負載平衡器後方。 此範例會使用自定義腳本來執行應用程式部署和更新,您可能必須為自己的更新程式提供自定義腳本。 您必須在建立 VMSS 的相同訂用帳戶和區域中,提供 VM 的一般化映像。
使用 Windows 自定義映射部署 VM 擴展集

部署至 Azure
此範本可讓您部署簡單的 VM 擴展集,並設定自訂 Windows 映像。 這些 VM 預設會在埠 80) 上使用 HTTP 負載平衡 (的負載平衡器後方

Terraform (AzAPI 提供者) 資源定義

映射資源類型可以使用目標作業來部署:

  • 資源群組

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

資源格式

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

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Compute/images@2021-07-01"
  name = "string"
  location = "string"
  parent_id = "string"
  tags = {
    tagName1 = "tagValue1"
    tagName2 = "tagValue2"
  }
  body = jsonencode({
    properties = {
      hyperVGeneration = "string"
      sourceVirtualMachine = {
        id = "string"
      }
      storageProfile = {
        dataDisks = [
          {
            blobUri = "string"
            caching = "string"
            diskEncryptionSet = {
              id = "string"
            }
            diskSizeGB = int
            lun = int
            managedDisk = {
              id = "string"
            }
            snapshot = {
              id = "string"
            }
            storageAccountType = "string"
          }
        ]
        osDisk = {
          blobUri = "string"
          caching = "string"
          diskEncryptionSet = {
            id = "string"
          }
          diskSizeGB = int
          managedDisk = {
            id = "string"
          }
          osState = "string"
          osType = "string"
          snapshot = {
            id = "string"
          }
          storageAccountType = "string"
        }
        zoneResilient = bool
      }
    }
    extendedLocation = {
      name = "string"
      type = "EdgeZone"
    }
  })
}

屬性值

images

名稱 描述
類型 資源類型 “Microsoft.Compute/images@2021-07-01”
NAME 資源名稱 需要字串 ()

字元限制:1-80

合法字元:
英數字元、底線、句號和連字號。

以英數字元開頭。 以英數字元或底線結尾。
location 資源位置 需要字串 ()
parent_id 若要部署至資源群組,請使用該資源群組的標識碼。 需要字串 ()
tags 資源標籤 標記名稱和值的字典。
extendedLocation Image 的擴充位置。 ExtendedLocation
properties 描述 Image 的屬性。 ImageProperties

ExtendedLocation

名稱 描述
NAME 擴充位置的名稱。 字串
type 擴充位置的類型。 “EdgeZone”

ImageProperties

名稱 描述
hyperVGeneration 指定從映像建立之 VirtualMachine 的 HyperVGenerationType。 從 API 版本 2019-03-01 如果映射來源是 Blob,則我們需要使用者指定值,如果來源是磁碟或快照集的受控資源,則如果我們無法從來源受控資源推斷它,則可能需要使用者指定 屬性。 “V1”
“V2”
sourceVirtualMachine 建立映像的來源虛擬機。 SubResource
storageProfile 指定虛擬機器磁碟的儲存體設定。 ImageStorageProfile

SubResource

名稱 描述
id 資源標識碼 字串

ImageStorageProfile

名稱 描述
dataDisks 指定用來將資料磁碟加入至虛擬機器的參數。

如需磁碟的詳細資訊,請參閱 關於 Azure 虛擬機的磁碟和 VHD
ImageDataDisk[]
osDisk 指定虛擬機所使用的作業系統磁碟相關信息。

如需磁碟的詳細資訊,請參閱 關於 Azure 虛擬機的磁碟和 VHD
ImageOSDisk
zoneResilient 指定映像是否具有區域復原能力。 預設值為 false。 區域復原映像只能建立在提供區域備援記憶體 (ZRS) 的區域。 bool

ImageDataDisk

名稱 描述
blobUri 虛擬硬碟。 字串
快取 指定快取需求。

可能的值包括:



ReadOnly

讀寫

預設值: 標準記憶體無。進階記憶體的 ReadOnly
"None"
“ReadOnly”
“ReadWrite”
diskEncryptionSet 指定受控映像磁碟的客戶受控磁碟加密集資源標識碼。 DiskEncryptionSetParameters
diskSizeGB 指定以 GB 為單位的空白資料磁碟大小。 此元素可用來覆寫虛擬機映像中的磁碟名稱。

此值不能大於 1023 GB
int
lun 指定數據磁碟的邏輯單元編號。 這個值是用來識別 VM 內的數據磁碟,因此對於連結至 VM 的每個數據磁碟都必須是唯一的。 需要 int ()
ManagedDisk managedDisk。 SubResource
快照集 快照集。 SubResource
storageAccountType 指定受控磁碟的記憶體帳戶類型。 注意:UltraSSD_LRS只能與數據磁碟搭配使用,因此無法與OS磁碟搭配使用。 "Premium_LRS"
“Premium_ZRS”
"StandardSSD_LRS"
“StandardSSD_ZRS”
"Standard_LRS"
“UltraSSD_LRS”

DiskEncryptionSetParameters

名稱 描述
id 資源標識碼 字串

ImageOSDisk

名稱 描述
blobUri 虛擬硬碟。 字串
快取 指定快取需求。

可能的值包括:



ReadOnly

讀寫

預設值: 標準記憶體無。進階記憶體的 ReadOnly
"None"
“ReadOnly”
“ReadWrite”
diskEncryptionSet 指定受控映像磁碟的客戶受控磁碟加密集資源標識碼。 DiskEncryptionSetParameters
diskSizeGB 指定以 GB 為單位的空白資料磁碟大小。 此元素可用來覆寫虛擬機映像中的磁碟名稱。

此值不能大於 1023 GB
int
ManagedDisk managedDisk。 SubResource
osState OS 狀態。 “一般化”
「特製化」 (必要)
osType 此屬性可讓您指定從自定義映像建立 VM 時,磁碟中包含的 OS 類型。

可能的值包括:

Windows

Linux
"Linux"
“Windows” (必要)
快照集 快照集。 SubResource
storageAccountType 指定受控磁碟的記憶體帳戶類型。 注意:UltraSSD_LRS只能與數據磁碟搭配使用,因此無法與OS磁碟搭配使用。 "Premium_LRS"
“Premium_ZRS”
"StandardSSD_LRS"
“StandardSSD_ZRS”
"Standard_LRS"
“UltraSSD_LRS”