你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Microsoft.Compute disks 2022-03-02

Bicep 资源定义

可以使用面向以下操作部署磁盘资源类型:

有关每个 API 版本中已更改属性的列表,请参阅 更改日志

资源格式

若要创建 Microsoft.Compute/disks 资源,请将以下 Bicep 添加到模板。

resource symbolicname 'Microsoft.Compute/disks@2022-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'
      galleryImageReference: {
        communityGalleryImageId: 'string'
        id: 'string'
        lun: int
        sharedGalleryImageId: 'string'
      }
      imageReference: {
        communityGalleryImageId: 'string'
        id: 'string'
        lun: int
        sharedGalleryImageId: 'string'
      }
      logicalSectorSize: int
      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'
    osType: 'string'
    publicNetworkAccess: 'string'
    purchasePlan: {
      name: 'string'
      product: 'string'
      promotionCode: 'string'
      publisher: 'string'
    }
    securityProfile: {
      secureVMDiskEncryptionSetId: 'string'
      securityType: 'string'
    }
    supportedCapabilities: {
      acceleratedNetwork: bool
      architecture: 'string'
    }
    supportsHibernation: bool
    tier: 'string'
  }
  zones: [
    'string'
  ]
}

属性值

disks

名称 说明
name 资源名称 字符串 (必需)

字符限制:1-80

有效字符:
字母数字、下划线字符和连字符。
location 资源位置 字符串 (必需)
标记 资源标记 标记名称和值的字典。 请参阅 模板中的标记
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 可启用超出磁盘预配的性能目标的突发。 默认情况下,突发处于禁用状态。 不适用于超级磁盘。 bool
completionPercent 通过 CopyStart 操作创建资源时后台副本的完成百分比。 int
creationData 磁盘源信息。 创建磁盘后,无法更改创建数据信息。 CreationData (必需)
dataAccessAuthMode 导出或上传到磁盘或快照时的其他身份验证要求。 “AzureActiveDirectory”
“None”
diskAccessId 用于在磁盘上使用专用终结点的 DiskAccess 资源的 ARM ID。 字符串
diskIOPSReadWrite 此磁盘允许的 IOPS 数;只能为 UltraSSD 磁盘设置。 一个操作可以在 4k 到 256k 字节之间传输。 int
diskMBpsReadWrite 此磁盘允许的带宽;只能为 UltraSSD 磁盘设置。 MBps 表示每秒数百万字节 - 此处的 MB 使用 ISO 表示法,其幂为 10。 int
diskSizeGB 如果 creationData.createOption 为 Empty,则此字段是必需的,它指示要创建的磁盘的大小。 如果此字段可用于使用其他选项进行更新或创建,则表示调整大小。 仅当磁盘未附加到正在运行的 VM 时,才允许重设大小,并且只能增加磁盘的大小。 int
加密 加密属性可用于使用客户管理的密钥或平台管理的密钥加密静态数据。 加密
encryptionSettingsCollection 用于 Azure 磁盘加密的加密设置集合可以包含每个磁盘或快照的多个加密设置。 EncryptionSettingsCollection
hyperVGeneration 虚拟机的虚拟机监控程序生成。 仅适用于 OS 磁盘。 “V1”
“V2”
maxShares 可以同时附加到磁盘的最大 VM 数。 大于 1 的值表示可以同时装载到多个 VM 上的磁盘。 int
networkAccessPolicy 用于通过网络访问磁盘的策略。 “AllowAll”
“AllowPrivate”
“DenyAll”
osType 操作系统类型。 “Linux”
“Windows”
publicNetworkAccess 用于控制磁盘导出的策略。 “Disabled”
“已启用”
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/。 不适用于超级磁盘。 字符串

CreationData

名称 说明
createOption 这会枚举创建磁盘的可能源。 “附加”
“Copy”
“CopyStart”
“空”
“FromImage”
“Import”
“ImportSecure”
“还原”
“Upload”
“UploadPreparedSecure” (必需)
galleryImageReference 从库映像创建时是必需的。 ImageDiskReference 的 id/sharedGalleryImageId/communityGalleryImageId 将是创建磁盘的共享映像版本的 ARM ID。 ImageDiskReference
imageReference PIR 或用户映像的磁盘源信息。 ImageDiskReference
logicalSectorSize 超级磁盘的逻辑扇区大小(以字节为单位)。 支持的值为 512 和 4096。 4096 是默认值。 int
securityDataUri 如果 createOption 为 ImportSecure,则这是要导入到 VM 来宾状态的 Blob 的 URI。 字符串
sourceResourceId 如果 createOption 为 Copy,则这是源快照或磁盘的 ARM ID。 字符串
sourceUri 如果 createOption 为 Import,则这是要导入到托管磁盘的 Blob 的 URI。 字符串
storageAccountId 如果 createOption 为 Import,则是必需的。 Azure 资源管理器存储帐户的标识符,其中包含要导入为磁盘的 Blob。 字符串
uploadSizeBytes 如果 createOption 为 Upload,则表示上传内容(包括 VHD 页脚)的大小。 对于 VHD 页脚) ,此值应介于 20972032 (20 MiB + 512 字节之间,VHD 页脚) (32 TiB + 512 字节35183298347520字节。 int

ImageDiskReference

名称 说明
communityGalleryImageId 包含社区 Azure 计算库映像引用的相对 URI。 string
id 包含平台映像存储库、用户映像或 Azure Compute Gallery 映像引用的相对 URI。 字符串
lun 如果磁盘是从映像的数据磁盘创建的,则此索引指示要使用的映像中的数据磁盘。 对于 OS 磁盘,此字段为 null。 int
sharedGalleryImageId 包含直接共享 Azure Compute Gallery 映像引用的相对 URI。 字符串

Encryption

名称 说明
diskEncryptionSetId 要用于启用静态加密的磁盘加密集的 ResourceId。 字符串
type 用于加密磁盘数据的密钥类型。 “EncryptionAtRestWithCustomerKey”
'EncryptionAtRestWithPlatformAndCustomerKeys'
“EncryptionAtRestWithPlatformKey”

EncryptionSettingsCollection

名称 说明
enabled 将此标志设置为 true,并提供 DiskEncryptionKey 和可选的 KeyEncryptionKey 以启用加密。 将此标志设置为 false 并删除 DiskEncryptionKey 和 KeyEncryptionKey 以禁用加密。 如果请求对象中的 EncryptionSettings 为 null,则现有设置保持不变。 需要 bool ()
encryptionSettings 加密设置的集合,每个磁盘卷对应一个。 EncryptionSettingsElement[]
encryptionSettingsVersion 描述磁盘使用的加密类型。 设置此字段后,无法覆盖该字段。 “1.0”对应于使用 AAD 应用的 Azure 磁盘加密。“1.1”对应于 Azure 磁盘加密。 字符串

EncryptionSettingsElement

名称 说明
diskEncryptionKey 密钥保管库磁盘加密密钥的机密 URL 和保管库 ID KeyVaultAndSecretReference
keyEncryptionKey 密钥保管库密钥加密密钥的密钥 URL 和保管库 ID。 KeyEncryptionKey 是可选的,如果提供,则用于解包磁盘加密密钥。 KeyVaultAndKeyReference

KeyVaultAndSecretReference

名称 说明
secretUrl 指向 KeyVault 中的密钥或机密的 URL 字符串 (必需)
sourceVault 包含密钥或机密的 KeyVault 的资源 ID 需要 sourceVault ()

SourceVault

名称 说明 Value
id 资源 ID 字符串

KeyVaultAndKeyReference

名称 说明
keyUrl 指向 KeyVault 中的密钥或机密的 URL 字符串 (必需)
sourceVault 包含密钥或机密的 KeyVault 的资源 ID 需要 sourceVault ()

PurchasePlan

名称 说明
name 计划 ID。 字符串 (必需)
product 指定市场中映像的乘积。 此值与 imageReference 元素下的 Offer 值相同。 字符串 (必需)
promotionCode 产品/服务促销代码。 字符串
发布者 发布者 ID。 字符串 (必需)

DiskSecurityProfile

名称 说明
secureVMDiskEncryptionSetId 与使用客户管理的密钥加密的机密 VM 支持的磁盘关联的磁盘加密集的 ResourceId 字符串
securityType 指定 VM 的 SecurityType。 仅适用于 OS 磁盘。 “ConfidentialVM_DiskEncryptedWithCustomerKey”
“ConfidentialVM_DiskEncryptedWithPlatformKey”
“ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey”
“TrustedLaunch”

SupportedCapabilities

名称 说明
acceleratedNetwork 如此 如果从中创建 OS 磁盘的映像支持加速网络。 bool
体系结构 OS 磁盘支持的 CPU 体系结构。 “Arm64”
“x64”

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 主机
创建具有特定扇区大小的超级托管磁盘

部署到 Azure
此模板创建新的超级托管磁盘,允许用户将扇区大小指定为 512 或 4096。
从 EfficientIP VHD 创建 VM

部署到 Azure
此模板从 EfficientIP VHD 创建 VM,并允许将其连接到现有 VNET,该 VNET 可以驻留在另一个资源组中,然后是虚拟机
从现有 VHD 创建 VM 并将其连接到现有VNET

部署到 Azure
此模板从 VHD (OS + 数据磁盘) 创建 VM,并允许将其连接到可以驻留在另一个资源组中的现有 VNET,然后是虚拟机
从自定义 VHD 在新的或现有的 vnet 中创建 VM

部署到 Azure
此模板从专用 VHD 创建 VM,并允许将其连接到新的或现有的 VNET,该 VNET 可以驻留在虚拟机以外的另一个资源组中
使用 SSH 的 Windows Server VM

部署到 Azure
部署启用了开放 SSH 的单个 Windows VM,以便可以使用基于密钥的身份验证通过 SSH 进行连接。
创建磁盘 & 通过备份保管库启用保护

部署到 Azure
用于创建磁盘并通过备份保管库启用保护的模板
UltraSSD 上的 SQL VM 性能优化存储设置

部署到 Azure
使用适用于 SQL 日志文件的 UltraSSD 创建具有性能优化存储设置的SQL Server虚拟机

ARM 模板资源定义

磁盘资源类型可以使用面向以下对象的操作进行部署:

有关每个 API 版本中更改的属性的列表,请参阅 更改日志

资源格式

若要创建 Microsoft.Compute/disks 资源,请将以下 JSON 添加到模板。

{
  "type": "Microsoft.Compute/disks",
  "apiVersion": "2022-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",
      "galleryImageReference": {
        "communityGalleryImageId": "string",
        "id": "string",
        "lun": "int",
        "sharedGalleryImageId": "string"
      },
      "imageReference": {
        "communityGalleryImageId": "string",
        "id": "string",
        "lun": "int",
        "sharedGalleryImageId": "string"
      },
      "logicalSectorSize": "int",
      "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",
    "osType": "string",
    "publicNetworkAccess": "string",
    "purchasePlan": {
      "name": "string",
      "product": "string",
      "promotionCode": "string",
      "publisher": "string"
    },
    "securityProfile": {
      "secureVMDiskEncryptionSetId": "string",
      "securityType": "string"
    },
    "supportedCapabilities": {
      "acceleratedNetwork": "bool",
      "architecture": "string"
    },
    "supportsHibernation": "bool",
    "tier": "string"
  },
  "zones": [ "string" ]
}

属性值

disks

名称 说明 Value
type 资源类型 “Microsoft.Compute/disks”
apiVersion 资源 API 版本 '2022-03-02'
name 资源名称 字符串 (必需)

字符限制:1-80

有效字符:
字母数字、下划线字符和连字符。
location 资源位置 字符串 (必需)
标记 资源标记 标记名称和值的字典。 请参阅 模板中的标记
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 可启用超出磁盘预配性能目标的突发。 默认情况下,突发处于禁用状态。 不适用于超级磁盘。 bool
completionPercent 通过 CopyStart 操作创建资源时后台副本的完成百分比。 int
creationData 磁盘源信息。 创建磁盘后,无法更改创建数据信息。 CreationData (必需)
dataAccessAuthMode 导出或上传到磁盘或快照时的其他身份验证要求。 “AzureActiveDirectory”
“None”
diskAccessId 用于在磁盘上使用专用终结点的 DiskAccess 资源的 ARM ID。 字符串
diskIOPSReadWrite 此磁盘允许的 IOPS 数;只能为 UltraSSD 磁盘设置。 一个操作可以在 4k 到 256k 字节之间传输。 int
diskMBpsReadWrite 此磁盘允许的带宽;只能为 UltraSSD 磁盘设置。 MBps 表示每秒数百万字节 - 此处的 MB 使用 ISO 表示法,幂为 10。 int
diskSizeGB 如果 creationData.createOption 为空,则此字段是必需的,它指示要创建的磁盘的大小。 如果存在此字段用于更新或创建其他选项,则表示调整大小。 仅当磁盘未附加到正在运行的 VM 时,才允许调整大小,并且只能增加磁盘的大小。 int
加密 加密属性可用于使用客户管理的密钥或平台管理的密钥加密静态数据。 加密
encryptionSettingsCollection 用于 Azure 磁盘加密的加密设置集合可以包含每个磁盘或快照的多个加密设置。 EncryptionSettingsCollection
hyperVGeneration 虚拟机的虚拟机监控程序生成。 仅适用于 OS 磁盘。 “V1”
“V2”
maxShares 可以同时附加到磁盘的最大 VM 数。 大于 1 的值表示可以同时装载到多个 VM 上的磁盘。 int
networkAccessPolicy 用于通过网络访问磁盘的策略。 “AllowAll”
“AllowPrivate”
“DenyAll”
osType 操作系统类型。 “Linux”
“Windows”
publicNetworkAccess 用于控制磁盘导出的策略。 “Disabled”
“已启用”
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/。 不适用于超级磁盘。 字符串

CreationData

名称 说明
createOption 这会枚举创建磁盘的可能源。 “附加”
“Copy”
“CopyStart”
“空”
“FromImage”
“Import”
“ImportSecure”
“还原”
“Upload”
“UploadPreparedSecure” (必需)
galleryImageReference 从库映像创建时是必需的。 ImageDiskReference 的 id/sharedGalleryImageId/communityGalleryImageId 将是创建磁盘的共享映像版本的 ARM ID。 ImageDiskReference
imageReference PIR 或用户映像的磁盘源信息。 ImageDiskReference
logicalSectorSize 超级磁盘的逻辑扇区大小(以字节为单位)。 支持的值为 512 和 4096。 4096 是默认值。 int
securityDataUri 如果 createOption 为 ImportSecure,则这是要导入到 VM 来宾状态的 Blob 的 URI。 字符串
sourceResourceId 如果 createOption 为 Copy,则这是源快照或磁盘的 ARM ID。 字符串
sourceUri 如果 createOption 为 Import,则这是要导入到托管磁盘的 Blob 的 URI。 字符串
storageAccountId 如果 createOption 为 Import,则是必需的。 Azure 资源管理器存储帐户的标识符,其中包含要导入为磁盘的 Blob。 字符串
uploadSizeBytes 如果 createOption 为 Upload,则表示上传内容(包括 VHD 页脚)的大小。 对于 VHD 页脚) ,此值应介于 20972032 (20 MiB + 512 字节之间,VHD 页脚) (32 TiB + 512 字节35183298347520字节。 int

ImageDiskReference

名称 说明
communityGalleryImageId 包含社区 Azure 计算库映像引用的相对 URI。 string
id 包含平台映像存储库、用户映像或 Azure Compute Gallery 映像引用的相对 URI。 字符串
lun 如果磁盘是从映像的数据磁盘创建的,则此索引指示要使用的映像中的数据磁盘。 对于 OS 磁盘,此字段为 null。 int
sharedGalleryImageId 包含直接共享 Azure 计算库映像引用的相对 URI。 字符串

Encryption

名称 说明
diskEncryptionSetId 要用于启用静态加密的磁盘加密集的 ResourceId。 字符串
type 用于加密磁盘数据的密钥类型。 “EncryptionAtRestWithCustomerKey”
“EncryptionAtRestWithPlatformAndCustomerKeys”
“EncryptionAtRestWithPlatformKey”

EncryptionSettingsCollection

名称 说明
enabled 将此标志设置为 true,并提供 DiskEncryptionKey 和可选的 KeyEncryptionKey 以启用加密。 将此标志设置为 false 并删除 DiskEncryptionKey 和 KeyEncryptionKey 以禁用加密。 如果请求对象中的 EncryptionSettings 为 null,则现有设置保持不变。 bool (必需)
encryptionSettings 加密设置的集合,每个磁盘卷各一个。 EncryptionSettingsElement[]
encryptionSettingsVersion 描述磁盘使用的加密类型。 设置此字段后,无法覆盖它。 “1.0”对应于使用 AAD 应用的 Azure 磁盘加密。“1.1”对应于 Azure 磁盘加密。 字符串

EncryptionSettingsElement

名称 说明
diskEncryptionKey 密钥保管库磁盘加密密钥的机密 URL 和保管库 ID KeyVaultAndSecretReference
keyEncryptionKey 密钥保管库密钥加密密钥的密钥 URL 和保管库 ID。 KeyEncryptionKey 是可选的,提供时用于解包磁盘加密密钥。 KeyVaultAndKeyReference

KeyVaultAndSecretReference

名称 说明
secretUrl 指向 KeyVault 中的密钥或机密的 URL 字符串 (必需)
sourceVault 包含密钥或机密的 KeyVault 的资源 ID SourceVault (必需)

SourceVault

名称 说明 Value
id 资源 ID 字符串

KeyVaultAndKeyReference

名称 说明
keyUrl 指向 KeyVault 中的密钥或机密的 URL 字符串 (必需)
sourceVault 包含密钥或机密的 KeyVault 的资源 ID SourceVault (必需)

PurchasePlan

名称 说明
name 计划 ID。 字符串 (必需)
product 指定市场中映像的产品。 此值与 imageReference 元素下的 Offer 相同。 字符串 (必需)
promotionCode 产品/服务促销代码。 字符串
发布者 发布者 ID。 字符串 (必需)

DiskSecurityProfile

名称 说明
secureVMDiskEncryptionSetId 与使用客户管理的密钥加密的机密 VM 支持的磁盘关联的磁盘加密集的 ResourceId 字符串
securityType 指定 VM 的 SecurityType。 仅适用于 OS 磁盘。 “ConfidentialVM_DiskEncryptedWithCustomerKey”
“ConfidentialVM_DiskEncryptedWithPlatformKey”
“ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey”
“TrustedLaunch”

SupportedCapabilities

名称 说明
acceleratedNetwork 如此 如果从中创建 OS 磁盘的映像支持加速网络。 bool
体系结构 OS 磁盘支持的 CPU 体系结构。 “Arm64”
“x64”

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 主机
创建具有特定扇区大小的超级托管磁盘

部署到 Azure
此模板创建新的超级托管磁盘,允许用户将扇区大小指定为 512 或 4096。
从 EfficientIP VHD 创建 VM

部署到 Azure
此模板从 EfficientIP VHD 创建 VM,并允许将其连接到现有 VNET,该 VNET 可以驻留在另一个资源组中,然后是虚拟机
从现有 VHD 创建 VM 并将其连接到现有VNET

部署到 Azure
此模板从 VHD (OS + 数据磁盘) 创建 VM,并允许将其连接到可以驻留在另一个资源组中的现有 VNET,然后是虚拟机
从自定义 VHD 在新的或现有的 vnet 中创建 VM

部署到 Azure
此模板从专用 VHD 创建 VM,并允许将其连接到新的或现有的 VNET,该 VNET 可以驻留在虚拟机以外的另一个资源组中
使用 SSH 的 Windows Server VM

部署到 Azure
部署启用了开放 SSH 的单个 Windows VM,以便可以使用基于密钥的身份验证通过 SSH 进行连接。
创建磁盘 & 通过备份保管库启用保护

部署到 Azure
创建磁盘并通过备份保管库启用保护的模板
UltraSSD 上的 SQL VM 性能优化存储设置

部署到 Azure
使用适用于 SQL 日志文件的 UltraSSD 创建具有性能优化存储设置的SQL Server虚拟机

Terraform (AzAPI 提供程序) 资源定义

可以使用面向以下操作部署磁盘资源类型:

  • 资源组

有关每个 API 版本中已更改属性的列表,请参阅 更改日志

资源格式

若要创建 Microsoft.Compute/disks 资源,请将以下 Terraform 添加到模板。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Compute/disks@2022-03-02"
  name = "string"
  location = "string"
  parent_id = "string"
  tags = {
    tagName1 = "tagValue1"
    tagName2 = "tagValue2"
  }
  body = jsonencode({
    properties = {
      burstingEnabled = bool
      completionPercent = int
      creationData = {
        createOption = "string"
        galleryImageReference = {
          communityGalleryImageId = "string"
          id = "string"
          lun = int
          sharedGalleryImageId = "string"
        }
        imageReference = {
          communityGalleryImageId = "string"
          id = "string"
          lun = int
          sharedGalleryImageId = "string"
        }
        logicalSectorSize = int
        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"
      osType = "string"
      publicNetworkAccess = "string"
      purchasePlan = {
        name = "string"
        product = "string"
        promotionCode = "string"
        publisher = "string"
      }
      securityProfile = {
        secureVMDiskEncryptionSetId = "string"
        securityType = "string"
      }
      supportedCapabilities = {
        acceleratedNetwork = bool
        architecture = "string"
      }
      supportsHibernation = bool
      tier = "string"
    }
    zones = [
      "string"
    ]
    sku = {
      name = "string"
    }
    extendedLocation = {
      name = "string"
      type = "EdgeZone"
    }
  })
}

属性值

disks

名称 说明 Value
type 资源类型 “Microsoft.Compute/disks@2022-03-02”
name 资源名称 字符串 (必需)

字符限制:1-80

有效字符:
字母数字、下划线字符和连字符。
location 资源位置 字符串 (必需)
parent_id 若要部署到资源组,请使用该资源组的 ID。 字符串 (必需)
标记 资源标记 标记名称和值的字典。
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 可启用超出磁盘预配的性能目标的突发。 默认情况下,突发处于禁用状态。 不适用于超级磁盘。 bool
completionPercent 通过 CopyStart 操作创建资源时后台副本的完成百分比。 int
creationData 磁盘源信息。 创建磁盘后,无法更改创建数据信息。 CreationData (必需)
dataAccessAuthMode 导出或上传到磁盘或快照时的其他身份验证要求。 “AzureActiveDirectory”
"None"
diskAccessId 用于在磁盘上使用专用终结点的 DiskAccess 资源的 ARM ID。 字符串
diskIOPSReadWrite 此磁盘允许的 IOPS 数;只能为 UltraSSD 磁盘设置。 一个操作可以在 4k 到 256k 字节之间传输。 int
diskMBpsReadWrite 此磁盘允许的带宽;只能为 UltraSSD 磁盘设置。 MBps 表示每秒数百万字节 - 此处的 MB 使用 ISO 表示法,其幂为 10。 int
diskSizeGB 如果 creationData.createOption 为 Empty,则此字段是必需的,它指示要创建的磁盘的大小。 如果此字段可用于使用其他选项进行更新或创建,则表示调整大小。 仅当磁盘未附加到正在运行的 VM 时,才允许重设大小,并且只能增加磁盘的大小。 int
加密 加密属性可用于使用客户管理的密钥或平台管理的密钥加密静态数据。 加密
encryptionSettingsCollection 用于 Azure 磁盘加密的加密设置集合可以包含每个磁盘或快照的多个加密设置。 EncryptionSettingsCollection
hyperVGeneration 虚拟机的虚拟机监控程序生成。 仅适用于 OS 磁盘。 “V1”
“V2”
maxShares 可以同时附加到磁盘的最大 VM 数。 大于 1 的值表示可以同时装载到多个 VM 上的磁盘。 int
networkAccessPolicy 用于通过网络访问磁盘的策略。 “AllowAll”
“AllowPrivate”
“DenyAll”
osType 操作系统类型。 “Linux”
“Windows”
publicNetworkAccess 用于控制磁盘导出的策略。 “Disabled”
“已启用”
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/。 不适用于超级磁盘。 字符串

CreationData

名称 说明
createOption 这会枚举创建磁盘的可能源。 “附加”
“Copy”
“CopyStart”
“Empty”
“FromImage”
“导入”
“ImportSecure”
“还原”
“上传”
“UploadPreparedSecure” (必需)
galleryImageReference 从库映像创建时是必需的。 ImageDiskReference 的 id/sharedGalleryImageId/communityGalleryImageId 将是创建磁盘的共享映像版本的 ARM ID。 ImageDiskReference
imageReference PIR 或用户映像的磁盘源信息。 ImageDiskReference
logicalSectorSize 超级磁盘的逻辑扇区大小(以字节为单位)。 支持的值为 512 和 4096。 4096 是默认值。 int
securityDataUri 如果 createOption 为 ImportSecure,则这是要导入到 VM 来宾状态的 Blob 的 URI。 字符串
sourceResourceId 如果 createOption 为 Copy,则这是源快照或磁盘的 ARM ID。 字符串
sourceUri 如果 createOption 为 Import,则这是要导入到托管磁盘的 Blob 的 URI。 字符串
storageAccountId 如果 createOption 为 Import,则是必需的。 Azure 资源管理器存储帐户的标识符,其中包含要导入为磁盘的 Blob。 字符串
uploadSizeBytes 如果 createOption 为 Upload,则表示上传内容(包括 VHD 页脚)的大小。 对于 VHD 页脚) ,此值应介于 20972032 (20 MiB + 512 字节之间,VHD 页脚) (32 TiB + 512 字节35183298347520字节。 int

ImageDiskReference

名称 说明
communityGalleryImageId 包含社区 Azure 计算库映像引用的相对 URI。 string
id 包含平台映像存储库、用户映像或 Azure Compute Gallery 映像引用的相对 URI。 字符串
lun 如果磁盘是从映像的数据磁盘创建的,则此索引指示要使用的映像中的数据磁盘。 对于 OS 磁盘,此字段为 null。 int
sharedGalleryImageId 包含直接共享 Azure 计算库映像引用的相对 URI。 字符串

Encryption

名称 说明
diskEncryptionSetId 要用于启用静态加密的磁盘加密集的 ResourceId。 字符串
type 用于加密磁盘数据的密钥类型。 “EncryptionAtRestWithCustomerKey”
“EncryptionAtRestWithPlatformAndCustomerKeys”
“EncryptionAtRestWithPlatformKey”

EncryptionSettingsCollection

名称 说明
enabled 将此标志设置为 true,并提供 DiskEncryptionKey 和可选的 KeyEncryptionKey 以启用加密。 将此标志设置为 false 并删除 DiskEncryptionKey 和 KeyEncryptionKey 以禁用加密。 如果请求对象中的 EncryptionSettings 为 null,则现有设置保持不变。 bool (必需)
encryptionSettings 加密设置的集合,每个磁盘卷各一个。 EncryptionSettingsElement[]
encryptionSettingsVersion 描述磁盘使用的加密类型。 设置此字段后,无法覆盖它。 “1.0”对应于使用 AAD 应用的 Azure 磁盘加密。“1.1”对应于 Azure 磁盘加密。 字符串

EncryptionSettingsElement

名称 说明
diskEncryptionKey 密钥保管库磁盘加密密钥的机密 URL 和保管库 ID KeyVaultAndSecretReference
keyEncryptionKey 密钥保管库密钥加密密钥的密钥 URL 和保管库 ID。 KeyEncryptionKey 是可选的,提供时用于解包磁盘加密密钥。 KeyVaultAndKeyReference

KeyVaultAndSecretReference

名称 说明
secretUrl 指向 KeyVault 中的密钥或机密的 URL 字符串 (必需)
sourceVault 包含密钥或机密的 KeyVault 的资源 ID SourceVault (必需)

SourceVault

名称 说明 Value
id 资源 ID 字符串

KeyVaultAndKeyReference

名称 说明
keyUrl 指向 KeyVault 中的密钥或机密的 URL 字符串 (必需)
sourceVault 包含密钥或机密的 KeyVault 的资源 ID SourceVault (必需)

PurchasePlan

名称 说明
name 计划 ID。 字符串 (必需)
product 指定市场中映像的产品。 此值与 imageReference 元素下的 Offer 相同。 字符串 (必需)
promotionCode 产品/服务促销代码。 字符串
发布者 发布者 ID。 字符串 (必需)

DiskSecurityProfile

名称 说明
secureVMDiskEncryptionSetId 与使用客户管理的密钥加密的机密 VM 支持的磁盘关联的磁盘加密集的 ResourceId 字符串
securityType 指定 VM 的 SecurityType。 仅适用于 OS 磁盘。 “ConfidentialVM_DiskEncryptedWithCustomerKey”
“ConfidentialVM_DiskEncryptedWithPlatformKey”
“ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey”
“TrustedLaunch”

SupportedCapabilities

名称 说明
acceleratedNetwork 如果从中创建 OS 磁盘的映像支持加速网络,则其值为 True。 bool
体系结构 OS 磁盘支持的 CPU 体系结构。 “Arm64”
“x64”

DiskSku

名称 说明
name SKU 名称。 “PremiumV2_LRS”
“Premium_LRS”
“Premium_ZRS”
“StandardSSD_LRS”
“StandardSSD_ZRS”
“Standard_LRS”
“UltraSSD_LRS”