共用方式為


Microsoft.Compute 磁碟

Bicep 資源定義

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

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

資源格式

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

resource symbolicname 'Microsoft.Compute/disks@2024-03-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' or int
  ]
}

屬性值

磁碟

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

字元限制:1-80

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

ExtendedLocation

名字 描述 價值
名字 擴充位置的名稱。 字串
類型 擴充位置的類型。 '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 為 Empty,則此欄位為必要字段,並指出要建立的磁碟大小。 如果此欄位存在以其他選項進行更新或建立,表示重設大小。 只有在磁碟未連結至執行中的 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
磁碟的效能層級(例如 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 ad 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 頁尾。 此值應介於 20972032 (VHD 頁尾為 20 MiB + 512 位元元組)和 35183298347520 個字節之間(VHD 頁尾為 32 TiB + 512 位元組)。 int

ImageDiskReference

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

加密

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

EncryptionSettingsCollection

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

EncryptionSettingsElement

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

KeyVaultAndSecretReference

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

SourceVault

名字 描述 價值
id 資源標識碼 字串

KeyVaultAndKeyReference

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

PurchasePlan

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

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

名字 描述 價值
名字 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,該 VNET 可以位於另一個資源群組中,然後是虛擬機
從現有的 VHD 建立 VM,並將其連線至現有的 VNET

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

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

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

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

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

ARM 樣本資源定義

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

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

資源格式

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

{
  "type": "Microsoft.Compute/disks",
  "apiVersion": "2024-03-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" or int ]
}

屬性值

磁碟

名字 描述 價值
類型 資源類型 'Microsoft.Compute/disks'
apiVersion 資源 API 版本 '2024-03-02'
名字 資源名稱 字串 (必要)

字元限制:1-80

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

ExtendedLocation

名字 描述 價值
名字 擴充位置的名稱。 字串
類型 擴充位置的類型。 '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 為 Empty,則此欄位為必要字段,並指出要建立的磁碟大小。 如果此欄位存在以其他選項進行更新或建立,表示重設大小。 只有在磁碟未連結至執行中的 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
磁碟的效能層級(例如 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 ad 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 頁尾。 此值應介於 20972032 (VHD 頁尾為 20 MiB + 512 位元元組)和 35183298347520 個字節之間(VHD 頁尾為 32 TiB + 512 位元組)。 int

ImageDiskReference

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

加密

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

EncryptionSettingsCollection

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

EncryptionSettingsElement

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

KeyVaultAndSecretReference

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

SourceVault

名字 描述 價值
id 資源標識碼 字串

KeyVaultAndKeyReference

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

PurchasePlan

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

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

名字 描述 價值
名字 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,該 VNET 可以位於另一個資源群組中,然後是虛擬機
從現有的 VHD 建立 VM,並將其連線至現有的 VNET

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

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

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

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

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

Terraform (AzAPI 提供者) 資源定義

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

  • 資源群組

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

資源格式

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

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Compute/disks@2024-03-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" or int
    ]
    sku = {
      name = "string"
    }
    extendedLocation = {
      name = "string"
      type = "EdgeZone"
    }
  })
}

屬性值

磁碟

名字 描述 價值
類型 資源類型 “Microsoft.Compute/disks@2024-03-02”
名字 資源名稱 字串 (必要)

字元限制:1-80

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

ExtendedLocation

名字 描述 價值
名字 擴充位置的名稱。 字串
類型 擴充位置的類型。 “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 為 Empty,則此欄位為必要字段,並指出要建立的磁碟大小。 如果此欄位存在以其他選項進行更新或建立,表示重設大小。 只有在磁碟未連結至執行中的 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
磁碟的效能層級(例如 P4、S10)如下所述:https://azure.microsoft.com/pricing/details/managed-disks/。 不適用於 Ultra 磁碟。 字串

CreationData

名字 描述 價值
createOption 這會列舉磁碟建立的可能來源。 “附加”
“Copy”
“CopyFromSanSnapshot”
“CopyStart”
“Empty”
“FromImage”
“匯入”
“ImportSecure”
“Restore”
“Upload”
“UploadPreparedSecure” (必要)
elasticSanResourceId 如果 createOption 是 CopyFromSanSnapshot,則為必要專案。 這是來源彈性 san 磁碟區快照集的 ARM 識別碼。 字串
galleryImageReference 如果從資源庫映射建立,則為必要專案。 ImageDiskReference 的 id/sharedGalleryImageId/communityGalleryImageId 將是用來建立磁碟之共用 galley 映射版本的 ARM 標識符。 ImageDiskReference
imageReference PIR 或使用者映像的磁碟來源資訊。 ImageDiskReference
logicalSectorSize Ultra 磁碟的邏輯扇區大小,以位元組為單位。 支援的值為 512 ad 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 頁尾。 此值應介於 20972032 (VHD 頁尾為 20 MiB + 512 位元元組)和 35183298347520 個字節之間(VHD 頁尾為 32 TiB + 512 位元組)。 int

ImageDiskReference

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

加密

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

EncryptionSettingsCollection

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

EncryptionSettingsElement

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

KeyVaultAndSecretReference

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

SourceVault

名字 描述 價值
id 資源標識碼 字串

KeyVaultAndKeyReference

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

PurchasePlan

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

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

名字 描述 價值
名字 SKU 名稱。 “PremiumV2_LRS”
“Premium_LRS”
“Premium_ZRS”
“StandardSSD_LRS”
“StandardSSD_ZRS”
“Standard_LRS”
“UltraSSD_LRS”