Share via


Microsoft.Compute 磁碟

Bicep 資源定義

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

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

資源格式

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

resource symbolicname 'Microsoft.Compute/disks@2023-10-02' = {
  name: 'string'
  location: 'string'
  tags: {
    tagName1: 'tagValue1'
    tagName2: 'tagValue2'
  }
  sku: {
    name: 'string'
  }
  extendedLocation: {
    name: 'string'
    type: 'EdgeZone'
  }
  properties: {
    burstingEnabled: bool
    completionPercent: int
    creationData: {
      createOption: 'string'
      elasticSanResourceId: 'string'
      galleryImageReference: {
        communityGalleryImageId: 'string'
        id: 'string'
        lun: int
        sharedGalleryImageId: 'string'
      }
      imageReference: {
        communityGalleryImageId: 'string'
        id: 'string'
        lun: int
        sharedGalleryImageId: 'string'
      }
      logicalSectorSize: int
      performancePlus: bool
      provisionedBandwidthCopySpeed: 'string'
      securityDataUri: 'string'
      sourceResourceId: 'string'
      sourceUri: 'string'
      storageAccountId: 'string'
      uploadSizeBytes: int
    }
    dataAccessAuthMode: 'string'
    diskAccessId: 'string'
    diskIOPSReadWrite: int
    diskMBpsReadWrite: int
    diskSizeGB: int
    encryption: {
      diskEncryptionSetId: 'string'
      type: 'string'
    }
    encryptionSettingsCollection: {
      enabled: bool
      encryptionSettings: [
        {
          diskEncryptionKey: {
            secretUrl: 'string'
            sourceVault: {
              id: 'string'
            }
          }
          keyEncryptionKey: {
            keyUrl: 'string'
            sourceVault: {
              id: 'string'
            }
          }
        }
      ]
      encryptionSettingsVersion: 'string'
    }
    hyperVGeneration: 'string'
    maxShares: int
    networkAccessPolicy: 'string'
    optimizedForFrequentAttach: bool
    osType: 'string'
    publicNetworkAccess: 'string'
    purchasePlan: {
      name: 'string'
      product: 'string'
      promotionCode: 'string'
      publisher: 'string'
    }
    securityProfile: {
      secureVMDiskEncryptionSetId: 'string'
      securityType: 'string'
    }
    supportedCapabilities: {
      acceleratedNetwork: bool
      architecture: 'string'
      diskControllerTypes: 'string'
    }
    supportsHibernation: bool
    tier: 'string'
  }
  zones: [
    'string'
  ]
}

屬性值

disks

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

字元限制:1-80

合法字元:
英數字元、底線和連字號。
location 資源位置 字串 (必要)
tags 資源標籤 標記名稱和值的字典。 請參閱 範本中的標記
sku 磁碟 SKU 名稱。 可以是Standard_LRS、Premium_LRS、StandardSSD_LRS、UltraSSD_LRS、Premium_ZRS、StandardSSD_ZRS或PremiumV2_LRS。 DiskSku
extendedLocation 將建立磁碟的擴充位置。 無法變更擴充位置。 ExtendedLocation
properties 磁碟資源屬性。 DiskProperties
zones (區域) 磁碟的邏輯區域清單。 string[]

ExtendedLocation

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

DiskProperties

名稱 描述
burstingEnabled 設定為 true,以啟用超出磁碟布建效能目標的高載。 磁碟高載預設為停用。 不適用於 Ultra 磁碟。 bool
completionPercent 透過 CopyStart 作業建立資源時,背景複本完成的百分比。 int
creationData 磁碟來源資訊。 建立磁碟之後,無法變更 CreationData 資訊。 CreationData (必要)
dataAccessAuthMode 匯出或上傳至磁碟或快照集時的其他驗證需求。 'AzureActiveDirectory'
'None'
diskAccessId 在磁碟上使用私人端點的 DiskAccess 資源的 ARM 識別碼。 字串
diskIOPSReadWrite 此磁碟允許的 IOPS 數目;僅適用於 UltraSSD 磁碟。 一個作業可以在 4k 到 256k 個字節之間傳輸。 int
diskMBpsReadWrite 此磁碟允許的頻寬;僅適用於 UltraSSD 磁碟。 MBps 表示每秒數百萬個字節 - 此處的 MB 使用 ISO 表示法,其乘冪為 10。 int
diskSizeGB 如果 creationData.createOption 是空的,則此欄位是必要欄位,而且會指出要建立的磁碟大小。 如果此欄位存在以使用其他選項進行更新或建立,則表示重設大小。 只有在磁碟未連結至執行中的 VM 時,才允許重設大小,而且只能增加磁碟的大小。 int
加密 加密屬性可用來使用客戶管理的密鑰或平臺受控金鑰來加密待用數據。 加密
encryptionSettingsCollection 用於 Azure 磁碟加密的加密設定集合可以包含每個磁碟或快照集的多個加密設定。 EncryptionSettingsCollection
hyperVGeneration 虛擬機的 Hypervisor 產生。 僅適用於OS磁碟。 'V1'
'V2'
maxShares 可以同時連結至磁碟的 VM 數目上限。 大於一的值表示可以同時掛接在多個 VM 上的磁碟。 int
networkAccessPolicy 透過網路存取磁碟的原則。 'AllowAll'
'AllowPrivate'
'DenyAll'
optimizedForFrequentAttach 將此屬性設定為 true 可改善經常 (一天超過 5 次的數據磁碟可靠性和效能,方法是從一部虛擬機中斷連結並連結至另一部虛擬機) 。 此屬性不應針對未中斷連結和經常連結的磁碟設定,因為它會導致磁碟與虛擬機的容錯網域不一致。 bool
osType 操作系統類型。 'Linux'
'Windows'
publicNetworkAccess 控制磁碟上導出的原則。 'Disabled'
'Enabled'
purchasePlan 建立OS磁碟所在映像的購買方案資訊。 例如 - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer} PurchasePlan
securityProfile 包含資源的安全性相關信息。 DiskSecurityProfile
supportedCapabilities 建立OS磁碟之映像的支援功能清單。 SupportedCapabilities
supportsHibernation 指出磁碟上的OS支援休眠。 bool
tier 磁碟 (效能層級,例如 P4、S10) ,如下所述: https://azure.microsoft.com/pricing/details/managed-disks/。 不適用於 Ultra 磁碟。 字串

CreationData

名稱 描述
createOption 這會列舉磁碟建立的可能來源。 'Attach'
'Copy'
'CopyFromSanSnapshot'
'CopyStart'
'Empty'
'FromImage'
'Import'
'ImportSecure'
'Restore'
'Upload'
'UploadPreparedSecure' (必要)
elasticSanResourceId 如果 createOption 為 CopyFromSanSnapshot,則為必要專案。 這是來源彈性 san 磁碟區快照集的 ARM 識別碼。 字串
galleryImageReference 如果從資源庫映射建立,則為必要專案。 ImageDiskReference 的 id/sharedGalleryImageId/communityGalleryImageId 將會是用來建立磁碟之共用 galley 映射版本的 ARM 標識符。 ImageDiskReference
imageReference PIR 或使用者映像的磁碟來源資訊。 ImageDiskReference
logicalSectorSize Ultra 磁碟的邏輯扇區大小,以位元組為單位。 支援的值為 512 和 4096。 預設為 4096。 int
performancePlus 將此旗標設定為 true,以提升所部署磁碟的效能目標,請參閱這裡的個別效能目標。 此旗標只能在磁碟建立時間上設定,且無法在啟用之後停用。 bool
provisionedBandwidthCopySpeed 如果在快照集上設定此字段,且 createOption 為 CopyStart,快照集會以更快的速度複製。 'Enhanced'
'None'
securityDataUri 如果 createOption 為 ImportSecure,這是要匯入至 VM 客體狀態之 Blob 的 URI。 字串
sourceResourceId 如果 createOption 是 Copy,這是來源快照集或磁碟的 ARM 識別碼。 字串
sourceUri 如果 createOption 為 Import,這是要匯入至受控磁碟之 Blob 的 URI。 字串
storageAccountId 如果 createOption 為 Import,則為必要項。 記憶體帳戶的 Azure Resource Manager 識別符,其中包含要匯入為磁碟的 Blob。 字串
uploadSizeBytes 如果 createOption 是 Upload,則這是上傳內容的大小,包括 VHD 頁尾。 此值應該介於 VHD 頁尾) 20972032 (20 MiB + 512 個字節之間 35183298347520,而 VHD 頁尾 (32 TiB + 512 個字節) 。 int

ImageDiskReference

名稱 描述
communityGalleryImageId 包含社群 Azure 計算資源庫映像參考的相對 URI。 字串
id 包含平臺映像存放庫、使用者映像或 Azure 計算資源庫映像參考的相對 URI。 字串
lun 如果磁碟是從映射的數據磁碟建立,這是一個索引,指出要使用的映射中的數據磁碟。 針對OS磁碟,此欄位為 Null。 int
sharedGalleryImageId 包含直接共用 Azure 計算資源庫映像參考的相對 URI。 字串

加密

名稱 描述
diskEncryptionSetId 要用於啟用待用加密的磁碟加密集 ResourceId。 字串
type 用來加密磁碟數據的金鑰類型。 'EncryptionAtRestWithCustomerKey'
'EncryptionAtRestWithPlatformAndCustomerKeys'
'EncryptionAtRestWithPlatformKey'

EncryptionSettingsCollection

名稱 描述
已啟用 將此旗標設定為 true,並提供 DiskEncryptionKey 和選擇性 KeyEncryptionKey 以啟用加密。 將此旗標設定為 false,然後移除 DiskEncryptionKey 和 KeyEncryptionKey 以停用加密。 如果 Request 物件中的 EncryptionSettings 為 Null,則現有的設定會保持不變。 bool (必要)
encryptionSettings 加密設定的集合,每個磁碟區各有一個。 EncryptionSettingsElement[]
encryptionSettingsVersion 描述磁碟使用的加密類型。 設定此欄位之後,就無法覆寫。 '1.0' 對應至具有 AAD 應用程式的 Azure 磁碟加密。'1.1' 對應至 Azure 磁碟加密。 字串

EncryptionSettingsElement

名稱 描述
diskEncryptionKey 金鑰保存庫 磁碟加密密鑰的秘密 URL 和保存庫識別碼 KeyVaultAndSecretReference
keyEncryptionKey 金鑰保存庫 金鑰加密金鑰的金鑰 URL 和保存庫識別碼。 KeyEncryptionKey 是選擇性的,而且當提供用來解除包裝磁碟加密密鑰時。 KeyVaultAndKeyReference

KeyVaultAndSecretReference

名稱 描述
secretUrl 指向 KeyVault 中金鑰或秘密的 URL 字串 (必要)
sourceVault 包含金鑰或秘密的 KeyVault 資源識別碼 SourceVault (必要)

SourceVault

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

KeyVaultAndKeyReference

名稱 描述
keyUrl 指向 KeyVault 中金鑰或秘密的 URL 字串 (必要)
sourceVault 包含金鑰或秘密的 KeyVault 資源識別碼 SourceVault (必要)

PurchasePlan

名稱 描述
NAME 方案標識碼。 字串 (必要)
產品 指定市集中映像的產品。 這個值與 imageReference 元素下的 Offer 相同。 字串 (必要)
promotionCode 供應項目促銷碼。 字串
publisher 發行者標識碼。 需要字串 ()

DiskSecurityProfile

名稱 描述
secureVMDiskEncryptionSetId 與使用客戶管理金鑰加密的機密 VM 支援磁碟相關聯的磁碟加密集 ResourceId 字串
securityType 指定 VM 的 SecurityType。 僅適用於OS磁碟。 'ConfidentialVM_DiskEncryptedWithCustomerKey'
'ConfidentialVM_DiskEncryptedWithPlatformKey'
'ConfidentialVM_NonPersistedTPM'
'ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey'
'TrustedLaunch'

SupportedCapabilities

名稱 描述
acceleratedNetwork 如果建立OS磁碟的映像支援加速網路,則為True。 bool
架構 OS 磁碟支援的CPU架構。 'Arm64'
'x64'
diskControllerTypes OS 磁碟支援的磁碟控制器。 如果設定它可以是 SCSI 或 SCSI、NVME 或 NVME、SCSI。 字串

DiskSku

名稱 描述
NAME SKU 名稱。 'PremiumV2_LRS'
'Premium_LRS'
'Premium_ZRS'
'StandardSSD_LRS'
'StandardSSD_ZRS'
'Standard_LRS'
'UltraSSD_LRS'

快速入門範本

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

範本 描述
在 可用性區域 中部署 3 個節點 Percona XtraDB 叢集

部署至 Azure
此範本會在 CentOS 6.5 或 Ubuntu 12.04 上部署 3 個節點 MySQL 高可用性叢集
已安裝 Portainer 和 Traefik 的 Windows Docker 主機

部署至 Azure
已安裝 Portainer 和 Traefik 的 Windows Docker 主機
建立具有特定扇區大小的 Ultra 受控磁碟

部署至 Azure
此範本會建立新的 Ultra 受控磁碟,讓用戶能夠指定 512 或 4096 的扇區大小。
從 EfficientIP VHD 建立 VM

部署至 Azure
此範本會從 EfficientIP VHD 建立 VM,並讓您將其連線到位於另一個資源群組中的現有 VNET,然後虛擬機
從現有的 VHD 建立 VM,並將其連線至現有的VNET

部署至 Azure
此範本會從 VHD 建立 VM (OS + 資料磁碟) ,並讓您將其連線到位於另一個資源群組的現有 VNET,然後虛擬機
從自定義 VHD 在新的或現有的 vnet 中建立 VM

部署至 Azure
此範本會從特製化 VHD 建立 VM,並讓您將其連線到新的或現有的 VNET,該 VNET 可以位於虛擬機以外的另一個資源群組中
具有 SSH 的 Windows Server VM

部署至 Azure
部署已啟用Open SSH 的單一 Windows VM,讓您可以使用金鑰型驗證透過 SSH 連線。
建立磁碟 & 透過備份保存庫啟用保護

部署至 Azure
建立磁碟並透過備份保存庫啟用保護的範本
UltraSSD 上的 SQL VM 效能優化記憶體設定

部署至 Azure
使用 UltraSSD for SQL 記錄檔建立具有效能優化記憶體設定的 SQL Server 虛擬機

ARM 範本資源定義

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

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

資源格式

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

{
  "type": "Microsoft.Compute/disks",
  "apiVersion": "2023-10-02",
  "name": "string",
  "location": "string",
  "tags": {
    "tagName1": "tagValue1",
    "tagName2": "tagValue2"
  },
  "sku": {
    "name": "string"
  },
  "extendedLocation": {
    "name": "string",
    "type": "EdgeZone"
  },
  "properties": {
    "burstingEnabled": "bool",
    "completionPercent": "int",
    "creationData": {
      "createOption": "string",
      "elasticSanResourceId": "string",
      "galleryImageReference": {
        "communityGalleryImageId": "string",
        "id": "string",
        "lun": "int",
        "sharedGalleryImageId": "string"
      },
      "imageReference": {
        "communityGalleryImageId": "string",
        "id": "string",
        "lun": "int",
        "sharedGalleryImageId": "string"
      },
      "logicalSectorSize": "int",
      "performancePlus": "bool",
      "provisionedBandwidthCopySpeed": "string",
      "securityDataUri": "string",
      "sourceResourceId": "string",
      "sourceUri": "string",
      "storageAccountId": "string",
      "uploadSizeBytes": "int"
    },
    "dataAccessAuthMode": "string",
    "diskAccessId": "string",
    "diskIOPSReadWrite": "int",
    "diskMBpsReadWrite": "int",
    "diskSizeGB": "int",
    "encryption": {
      "diskEncryptionSetId": "string",
      "type": "string"
    },
    "encryptionSettingsCollection": {
      "enabled": "bool",
      "encryptionSettings": [
        {
          "diskEncryptionKey": {
            "secretUrl": "string",
            "sourceVault": {
              "id": "string"
            }
          },
          "keyEncryptionKey": {
            "keyUrl": "string",
            "sourceVault": {
              "id": "string"
            }
          }
        }
      ],
      "encryptionSettingsVersion": "string"
    },
    "hyperVGeneration": "string",
    "maxShares": "int",
    "networkAccessPolicy": "string",
    "optimizedForFrequentAttach": "bool",
    "osType": "string",
    "publicNetworkAccess": "string",
    "purchasePlan": {
      "name": "string",
      "product": "string",
      "promotionCode": "string",
      "publisher": "string"
    },
    "securityProfile": {
      "secureVMDiskEncryptionSetId": "string",
      "securityType": "string"
    },
    "supportedCapabilities": {
      "acceleratedNetwork": "bool",
      "architecture": "string",
      "diskControllerTypes": "string"
    },
    "supportsHibernation": "bool",
    "tier": "string"
  },
  "zones": [ "string" ]
}

屬性值

disks

名稱 描述
類型 資源類型 'Microsoft.Compute/disks'
apiVersion 資源 API 版本 '2023-10-02'
NAME 資源名稱 需要字串 ()

字元限制:1-80

合法字元:
英數字元、底線和連字號。
location 資源位置 需要字串 ()
tags 資源標籤 標記名稱和值的字典。 請參閱 範本中的標籤
sku 磁碟 SKU 名稱。 可以是Standard_LRS、Premium_LRS、StandardSSD_LRS、UltraSSD_LRS、Premium_ZRS、StandardSSD_ZRS或PremiumV2_LRS。 DiskSku
extendedLocation 將建立磁碟的擴充位置。 無法變更擴充位置。 ExtendedLocation
properties 磁碟資源屬性。 DiskProperties
zones (區域) 磁碟的邏輯區域清單。 string[]

ExtendedLocation

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

DiskProperties

名稱 描述
burstingEnabled 設定為 true,以啟用超出磁碟布建效能目標的高載。 磁碟高載預設為停用。 不適用於 Ultra 磁碟。 bool
completionPercent 透過 CopyStart 作業建立資源時,背景複本完成的百分比。 int
creationData 磁碟來源資訊。 建立磁碟之後,無法變更 CreationData 資訊。 CreationData (必要)
dataAccessAuthMode 匯出或上傳至磁碟或快照集時的其他驗證需求。 'AzureActiveDirectory'
'None'
diskAccessId DiskAccess 資源的 ARM 識別碼,用於在磁碟上使用私人端點。 字串
diskIOPSReadWrite 此磁碟允許的 IOPS 數目;僅適用於 UltraSSD 磁碟的可設定。 一個作業可以在 4k 到 256k 個字節之間傳輸。 int
diskMBpsReadWrite 此磁碟允許的頻寬;僅適用於 UltraSSD 磁碟的可設定。 MBps 表示每秒數百萬個字節 - 此處的 ISO 表示法是 10 的乘冪。 int
diskSizeGB 如果 creationData.createOption 是空的,則此欄位為必要欄位,並指出要建立的磁碟大小。 如果此欄位存在以其他選項進行更新或建立,表示重設大小。 只有在磁碟未連結至執行中的 VM 時,才允許重設大小,而且只能增加磁碟的大小。 int
加密 加密屬性可用來使用客戶管理的密鑰或平臺管理金鑰來加密待用數據。 加密
encryptionSettingsCollection 用於 Azure 磁碟加密的加密設定集合可以包含每個磁碟或快照集的多個加密設定。 EncryptionSettingsCollection
hyperVGeneration 虛擬機的 Hypervisor 產生。 僅適用於OS磁碟。 'V1'
'V2'
maxShares 可以同時連結至磁碟的 VM 數目上限。 大於一的值表示可以同時掛接在多個 VM 上的磁碟。 int
networkAccessPolicy 透過網路存取磁碟的原則。 'AllowAll'
'AllowPrivate'
'DenyAll'
optimizedForFrequentAttach 將此屬性設定為 true 可改善經常 (一天超過 5 次的數據磁碟可靠性和效能,方法是從一部虛擬機中斷連結並連結至另一部虛擬機) 。 此屬性不應針對未中斷連結和經常連結的磁碟設定,因為它會導致磁碟與虛擬機的容錯網域不一致。 bool
osType 操作系統類型。 'Linux'
'Windows'
publicNetworkAccess 控制磁碟上導出的原則。 'Disabled'
'Enabled'
purchasePlan 建立OS磁碟所在映像的購買方案資訊。 例如 - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer} PurchasePlan
securityProfile 包含資源的安全性相關信息。 DiskSecurityProfile
supportedCapabilities 建立OS磁碟之映像的支援功能清單。 SupportedCapabilities
supportsHibernation 指出磁碟上的OS支援休眠。 bool
tier 磁碟 (效能層級,例如 P4、S10) ,如下所述: https://azure.microsoft.com/pricing/details/managed-disks/。 不適用於 Ultra 磁碟。 字串

CreationData

名稱 描述
createOption 這會列舉磁碟建立的可能來源。 'Attach'
'Copy'
'CopyFromSanSnapshot'
'CopyStart'
'Empty'
'FromImage'
'Import'
'ImportSecure'
'Restore'
'Upload'
'UploadPreparedSecure' (必要)
elasticSanResourceId 如果 createOption 為 CopyFromSanSnapshot,則為必要專案。 這是來源彈性 san 磁碟區快照集的 ARM 識別碼。 字串
galleryImageReference 如果從資源庫映射建立,則為必要專案。 ImageDiskReference 的 id/sharedGalleryImageId/communityGalleryImageId 將會是用來建立磁碟之共用 galley 映射版本的 ARM 標識符。 ImageDiskReference
imageReference PIR 或使用者映像的磁碟來源資訊。 ImageDiskReference
logicalSectorSize Ultra 磁碟的邏輯扇區大小,以位元組為單位。 支援的值為 512 和 4096。 預設為 4096。 int
performancePlus 將此旗標設定為 true,以提升所部署磁碟的效能目標,請參閱這裡的個別效能目標。 此旗標只能在磁碟建立時間上設定,且無法在啟用之後停用。 bool
provisionedBandwidthCopySpeed 如果在快照集上設定此字段,且 createOption 為 CopyStart,快照集會以更快的速度複製。 'Enhanced'
'None'
securityDataUri 如果 createOption 為 ImportSecure,這是要匯入至 VM 客體狀態之 Blob 的 URI。 字串
sourceResourceId 如果 createOption 是 Copy,這是來源快照集或磁碟的 ARM 識別碼。 字串
sourceUri 如果 createOption 為 Import,這是要匯入至受控磁碟之 Blob 的 URI。 字串
storageAccountId 如果 createOption 為 Import,則為必要項。 記憶體帳戶的 Azure Resource Manager 識別符,其中包含要匯入為磁碟的 Blob。 字串
uploadSizeBytes 如果 createOption 為 Upload,這是上傳內容的大小,包括 VHD 頁尾。 此值應該介於 VHD 頁尾) 20972032 (20 MiB + 512 個字節 35183298347520之間, (VHD 頁尾 (32 TiB + 512 個字節的 VHD 頁尾) 。 int

ImageDiskReference

名稱 描述
communityGalleryImageId 包含社群 Azure 計算資源庫映像參考的相對 URI。 字串
id 包含平臺映像存放庫、使用者映像或 Azure 計算資源庫映像參考的相對 URI。 字串
lun 如果磁碟是從映射的數據磁碟建立的,這是一個索引,指出要使用的映射中的數據磁碟。 針對OS磁碟,此欄位為 Null。 int
sharedGalleryImageId 包含直接共用 Azure 計算資源庫映像參考的相對 URI。 字串

加密

名稱 描述
diskEncryptionSetId 要用於啟用待用加密的磁碟加密集 ResourceId。 字串
type 用來加密磁碟數據的金鑰類型。 'EncryptionAtRestWithCustomerKey'
'EncryptionAtRestWithPlatformAndCustomerKeys'
'EncryptionAtRestWithPlatformKey'

EncryptionSettingsCollection

名稱 描述
已啟用 將此旗標設定為 true,並提供 DiskEncryptionKey 和選擇性 KeyEncryptionKey 以啟用加密。 將此旗標設定為 false,並移除 DiskEncryptionKey 和 KeyEncryptionKey 以停用加密。 如果 Request 物件中的 EncryptionSettings 為 null,則現有的設定會保持不變。 bool (必要)
encryptionSettings 加密設定的集合,每個磁碟區各一個。 EncryptionSettingsElement[]
encryptionSettingsVersion 描述磁碟所使用的加密類型。 設定此欄位之後,就無法覆寫。 '1.0' 對應至 AAD 應用程式的 Azure 磁碟加密。'1.1' 對應至 Azure 磁碟加密。 字串

EncryptionSettingsElement

名稱 描述
diskEncryptionKey 金鑰保存庫 磁碟加密密鑰的秘密 URL 和保存庫識別碼 KeyVaultAndSecretReference
keyEncryptionKey 金鑰保存庫 金鑰加密金鑰的金鑰 URL 和保存庫識別碼。 KeyEncryptionKey 是選擇性的,當提供 時會用來解除包裝磁碟加密密鑰。 KeyVaultAndKeyReference

KeyVaultAndSecretReference

名稱 描述
secretUrl 指向 KeyVault 中金鑰或秘密的 URL 需要字串 ()
sourceVault 包含金鑰或秘密的 KeyVault 資源識別碼 需要 SourceVault ()

SourceVault

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

KeyVaultAndKeyReference

名稱 描述
keyUrl 指向 KeyVault 中金鑰或秘密的 URL 需要字串 ()
sourceVault 包含金鑰或秘密的 KeyVault 資源識別碼 需要 SourceVault ()

PurchasePlan

名稱 描述
NAME 方案標識碼。 需要字串 ()
產品 指定市集中映像的產品。 這與 imageReference 元素下的 Offer 值相同。 需要字串 ()
promotionCode 供應項目促銷碼。 字串
publisher 發行者標識碼。 需要字串 ()

DiskSecurityProfile

名稱 描述
secureVMDiskEncryptionSetId 與使用客戶管理金鑰加密的機密 VM 支援磁碟相關聯的磁碟加密集 ResourceId 字串
securityType 指定 VM 的 SecurityType。 僅適用於OS磁碟。 'ConfidentialVM_DiskEncryptedWithCustomerKey'
'ConfidentialVM_DiskEncryptedWithPlatformKey'
'ConfidentialVM_NonPersistedTPM'
'ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey'
'TrustedLaunch'

SupportedCapabilities

名稱 描述
acceleratedNetwork 如果建立OS磁碟的映像支援加速網路,則為True。 bool
架構 OS 磁碟支援的CPU架構。 'Arm64'
'x64'
diskControllerTypes OS 磁碟支援的磁碟控制器。 如果設定它可以是 SCSI 或 SCSI、NVME 或 NVME、SCSI。 字串

DiskSku

名稱 描述
NAME SKU 名稱。 'PremiumV2_LRS'
'Premium_LRS'
'Premium_ZRS'
'StandardSSD_LRS'
'StandardSSD_ZRS'
'Standard_LRS'
'UltraSSD_LRS'

快速入門範本

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

範本 描述
在 可用性區域 中部署 3 個節點 Percona XtraDB 叢集

部署至 Azure
此範本會在 CentOS 6.5 或 Ubuntu 12.04 上部署 3 個節點 MySQL 高可用性叢集
已安裝 Portainer 和 Traefik 的 Windows Docker 主機

部署至 Azure
已安裝 Portainer 和 Traefik 的 Windows Docker 主機
建立具有特定扇區大小的 Ultra 受控磁碟

部署至 Azure
此範本會建立新的 Ultra 受控磁碟,讓用戶能夠指定 512 或 4096 的扇區大小。
從 EfficientIP VHD 建立 VM

部署至 Azure
此範本會從 EfficientIP VHD 建立 VM,並讓您將其連線到位於另一個資源群組中的現有 VNET,然後虛擬機
從現有的 VHD 建立 VM,並將其連線至現有的VNET

部署至 Azure
此範本會從 VHD 建立 VM (OS + 資料磁碟) ,並讓您將其連線到位於另一個資源群組的現有 VNET,然後虛擬機
從自定義 VHD 在新的或現有的 vnet 中建立 VM

部署至 Azure
此範本會從特製化 VHD 建立 VM,並讓您將其連線到新的或現有的 VNET,該 VNET 可以位於虛擬機以外的另一個資源群組中
具有 SSH 的 Windows Server VM

部署至 Azure
部署已啟用Open SSH 的單一 Windows VM,讓您可以使用金鑰型驗證透過 SSH 連線。
建立磁碟 & 透過備份保存庫啟用保護

部署至 Azure
建立磁碟並透過備份保存庫啟用保護的範本
UltraSSD 上的 SQL VM 效能優化記憶體設定

部署至 Azure
使用 UltraSSD for SQL 記錄檔建立具有效能優化記憶體設定的 SQL Server 虛擬機

Terraform (AzAPI 提供者) 資源定義

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

  • 資源群組

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

資源格式

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

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Compute/disks@2023-10-02"
  name = "string"
  location = "string"
  parent_id = "string"
  tags = {
    tagName1 = "tagValue1"
    tagName2 = "tagValue2"
  }
  body = jsonencode({
    properties = {
      burstingEnabled = bool
      completionPercent = int
      creationData = {
        createOption = "string"
        elasticSanResourceId = "string"
        galleryImageReference = {
          communityGalleryImageId = "string"
          id = "string"
          lun = int
          sharedGalleryImageId = "string"
        }
        imageReference = {
          communityGalleryImageId = "string"
          id = "string"
          lun = int
          sharedGalleryImageId = "string"
        }
        logicalSectorSize = int
        performancePlus = bool
        provisionedBandwidthCopySpeed = "string"
        securityDataUri = "string"
        sourceResourceId = "string"
        sourceUri = "string"
        storageAccountId = "string"
        uploadSizeBytes = int
      }
      dataAccessAuthMode = "string"
      diskAccessId = "string"
      diskIOPSReadWrite = int
      diskMBpsReadWrite = int
      diskSizeGB = int
      encryption = {
        diskEncryptionSetId = "string"
        type = "string"
      }
      encryptionSettingsCollection = {
        enabled = bool
        encryptionSettings = [
          {
            diskEncryptionKey = {
              secretUrl = "string"
              sourceVault = {
                id = "string"
              }
            }
            keyEncryptionKey = {
              keyUrl = "string"
              sourceVault = {
                id = "string"
              }
            }
          }
        ]
        encryptionSettingsVersion = "string"
      }
      hyperVGeneration = "string"
      maxShares = int
      networkAccessPolicy = "string"
      optimizedForFrequentAttach = bool
      osType = "string"
      publicNetworkAccess = "string"
      purchasePlan = {
        name = "string"
        product = "string"
        promotionCode = "string"
        publisher = "string"
      }
      securityProfile = {
        secureVMDiskEncryptionSetId = "string"
        securityType = "string"
      }
      supportedCapabilities = {
        acceleratedNetwork = bool
        architecture = "string"
        diskControllerTypes = "string"
      }
      supportsHibernation = bool
      tier = "string"
    }
    zones = [
      "string"
    ]
    sku = {
      name = "string"
    }
    extendedLocation = {
      name = "string"
      type = "EdgeZone"
    }
  })
}

屬性值

disks

名稱 描述
類型 資源類型 “Microsoft.Compute/disks@2023-10-02”
NAME 資源名稱 需要字串 ()

字元限制:1-80

合法字元:
英數字元、底線和連字號。
location 資源位置 需要字串 ()
parent_id 若要部署至資源群組,請使用該資源群組的標識碼。 需要字串 ()
tags 資源標籤 標記名稱和值的字典。
sku 磁碟 SKU 名稱。 可以是Standard_LRS、Premium_LRS、StandardSSD_LRS、UltraSSD_LRS、Premium_ZRS、StandardSSD_ZRS或PremiumV2_LRS。 DiskSku
extendedLocation 將建立磁碟的擴充位置。 無法變更擴充位置。 ExtendedLocation
properties 磁碟資源屬性。 DiskProperties
zones (區域) 磁碟的邏輯區域清單。 string[]

ExtendedLocation

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

DiskProperties

名稱 描述
burstingEnabled 設定為 true,以啟用超出磁碟布建效能目標的高載。 磁碟高載預設為停用。 不適用於 Ultra 磁碟。 bool
completionPercent 透過 CopyStart 作業建立資源時,背景複本完成的百分比。 int
creationData 磁碟來源資訊。 建立磁碟之後,無法變更 CreationData 資訊。 CreationData (必要)
dataAccessAuthMode 匯出或上傳至磁碟或快照集時的其他驗證需求。 “AzureActiveDirectory”
"None"
diskAccessId DiskAccess 資源的 ARM 識別碼,用於在磁碟上使用私人端點。 字串
diskIOPSReadWrite 此磁碟允許的 IOPS 數目;僅適用於 UltraSSD 磁碟的可設定。 一個作業可以在 4k 到 256k 個字節之間傳輸。 int
diskMBpsReadWrite 此磁碟允許的頻寬;僅適用於 UltraSSD 磁碟的可設定。 MBps 表示每秒數百萬個字節 - 此處的 ISO 表示法是 10 的乘冪。 int
diskSizeGB 如果 creationData.createOption 是空的,則此欄位為必要欄位,並指出要建立的磁碟大小。 如果此欄位存在以其他選項進行更新或建立,表示重設大小。 只有在磁碟未連結至執行中的 VM 時,才允許重設大小,而且只能增加磁碟的大小。 int
加密 加密屬性可用來使用客戶管理的密鑰或平臺管理金鑰來加密待用數據。 加密
encryptionSettingsCollection 用於 Azure 磁碟加密的加密設定集合可以包含每個磁碟或快照集的多個加密設定。 EncryptionSettingsCollection
hyperVGeneration 虛擬機的 Hypervisor 產生。 僅適用於OS磁碟。 “V1”
“V2”
maxShares 可以同時連結至磁碟的 VM 數目上限。 大於一的值表示可以同時掛接在多個 VM 上的磁碟。 int
networkAccessPolicy 透過網路存取磁碟的原則。 “AllowAll”
“AllowPrivate”
“DenyAll”
optimizedForFrequentAttach 將此屬性設定為 true 可改善經常 (一天超過 5 次的數據磁碟可靠性和效能,方法是從一部虛擬機中斷連結並連結至另一部虛擬機) 。 此屬性不應針對未中斷連結和經常連結的磁碟設定,因為它會導致磁碟與虛擬機的容錯網域不一致。 bool
osType 操作系統類型。 "Linux"
"Windows"
publicNetworkAccess 控制磁碟上導出的原則。 “Disabled”
“Enabled”
purchasePlan 建立OS磁碟所在映像的購買方案資訊。 例如 - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer} PurchasePlan
securityProfile 包含資源的安全性相關信息。 DiskSecurityProfile
supportedCapabilities 建立OS磁碟之映像的支援功能清單。 SupportedCapabilities
supportsHibernation 指出磁碟上的OS支援休眠。 bool
tier 磁碟 (效能層級,例如 P4、S10) ,如下所述: https://azure.microsoft.com/pricing/details/managed-disks/。 不適用於 Ultra 磁碟。 字串

CreationData

名稱 描述
createOption 這會列舉磁碟建立的可能來源。 “附加”
"Copy"
“CopyFromSanSnapshot”
“CopyStart”
"Empty"
“FromImage”
“匯入”
“ImportSecure”
“還原”
“上傳”
“UploadPreparedSecure” (必要)
elasticSanResourceId 如果 createOption 為 CopyFromSanSnapshot,則為必要專案。 這是來源彈性 san 磁碟區快照集的 ARM 識別碼。 字串
galleryImageReference 如果從資源庫映射建立,則為必要專案。 ImageDiskReference 的 id/sharedGalleryImageId/communityGalleryImageId 將會是用來建立磁碟之共用 galley 映射版本的 ARM 標識符。 ImageDiskReference
imageReference PIR 或使用者映像的磁碟來源資訊。 ImageDiskReference
logicalSectorSize Ultra 磁碟的邏輯扇區大小,以位元組為單位。 支援的值為 512 和 4096。 預設為 4096。 int
performancePlus 將此旗標設定為 true,以提升所部署磁碟的效能目標,請參閱這裡的個別效能目標。 此旗標只能在磁碟建立時間上設定,且無法在啟用之後停用。 bool
provisionedBandwidthCopySpeed 如果在快照集上設定此字段,且 createOption 為 CopyStart,快照集會以更快的速度複製。 “Enhanced”
"None"
securityDataUri 如果 createOption 為 ImportSecure,這是要匯入至 VM 客體狀態之 Blob 的 URI。 字串
sourceResourceId 如果 createOption 是 Copy,這是來源快照集或磁碟的 ARM 識別碼。 字串
sourceUri 如果 createOption 為 Import,這是要匯入至受控磁碟之 Blob 的 URI。 字串
storageAccountId 如果 createOption 為 Import,則為必要項。 記憶體帳戶的 Azure Resource Manager 識別符,其中包含要匯入為磁碟的 Blob。 字串
uploadSizeBytes 如果 createOption 為 Upload,這是上傳內容的大小,包括 VHD 頁尾。 此值應該介於 VHD 頁尾) 20972032 (20 MiB + 512 個字節 35183298347520之間, (VHD 頁尾 (32 TiB + 512 個字節的 VHD 頁尾) 。 int

ImageDiskReference

名稱 描述
communityGalleryImageId 包含社群 Azure 計算資源庫映像參考的相對 URI。 字串
id 包含平臺映像存放庫、使用者映像或 Azure 計算資源庫映像參考的相對 URI。 字串
lun 如果磁碟是從映射的數據磁碟建立的,這是一個索引,指出要使用的映射中的數據磁碟。 針對OS磁碟,此欄位為 Null。 int
sharedGalleryImageId 包含直接共用 Azure 計算資源庫映像參考的相對 URI。 字串

加密

名稱 描述
diskEncryptionSetId 要用於啟用待用加密的磁碟加密集 ResourceId。 字串
type 用來加密磁碟數據的金鑰類型。 “EncryptionAtRestWithCustomerKey”
“EncryptionAtRestWithPlatformAndCustomerKeys”
“EncryptionAtRestWithPlatformKey”

EncryptionSettingsCollection

名稱 描述
已啟用 將此旗標設定為 true,並提供 DiskEncryptionKey 和選擇性 KeyEncryptionKey 以啟用加密。 將此旗標設定為 false,並移除 DiskEncryptionKey 和 KeyEncryptionKey 以停用加密。 如果 Request 物件中的 EncryptionSettings 為 null,則現有的設定會保持不變。 bool (必要)
encryptionSettings 加密設定的集合,每個磁碟區各一個。 EncryptionSettingsElement[]
encryptionSettingsVersion 描述磁碟所使用的加密類型。 設定此欄位之後,就無法覆寫。 '1.0' 對應至 AAD 應用程式的 Azure 磁碟加密。'1.1' 對應至 Azure 磁碟加密。 字串

EncryptionSettingsElement

名稱 描述
diskEncryptionKey 金鑰保存庫 磁碟加密密鑰的秘密 URL 和保存庫識別碼 KeyVaultAndSecretReference
keyEncryptionKey 金鑰保存庫 金鑰加密金鑰的金鑰 URL 和保存庫識別碼。 KeyEncryptionKey 是選擇性的,當提供 時會用來解除包裝磁碟加密密鑰。 KeyVaultAndKeyReference

KeyVaultAndSecretReference

名稱 描述
secretUrl 指向 KeyVault 中金鑰或秘密的 URL 需要字串 ()
sourceVault 包含金鑰或秘密的 KeyVault 資源識別碼 需要 SourceVault ()

SourceVault

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

KeyVaultAndKeyReference

名稱 描述
keyUrl 指向 KeyVault 中金鑰或秘密的 URL 需要字串 ()
sourceVault 包含金鑰或秘密的 KeyVault 資源識別碼 需要 SourceVault ()

PurchasePlan

名稱 描述
NAME 方案標識碼。 需要字串 ()
產品 指定市集中映像的產品。 這與 imageReference 元素下的 Offer 值相同。 需要字串 ()
promotionCode 供應項目促銷碼。 字串
publisher 發行者標識碼。 需要字串 ()

DiskSecurityProfile

名稱 描述
secureVMDiskEncryptionSetId 與使用客戶管理金鑰加密的機密 VM 支援磁碟相關聯的磁碟加密集 ResourceId 字串
securityType 指定 VM 的 SecurityType。 僅適用於OS磁碟。 “ConfidentialVM_DiskEncryptedWithCustomerKey”
“ConfidentialVM_DiskEncryptedWithPlatformKey”
“ConfidentialVM_NonPersistedTPM”
“ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey”
“TrustedLaunch”

SupportedCapabilities

名稱 描述
acceleratedNetwork 如果建立OS磁碟的映像支援加速網路,則為True。 bool
架構 OS 磁碟支援的CPU架構。 “Arm64”
“x64”
diskControllerTypes OS 磁碟支援的磁碟控制器。 如果設定它可以是 SCSI 或 SCSI、NVME 或 NVME、SCSI。 字串

DiskSku

名稱 描述
NAME SKU 名稱。 “PremiumV2_LRS”
"Premium_LRS"
“Premium_ZRS”
"StandardSSD_LRS"
“StandardSSD_ZRS”
"Standard_LRS"
“UltraSSD_LRS”