Bicep 资源定义
可以使用目标操作部署 labs/virtualmachines 资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
若要创建 Microsoft.DevTestLab/labs/virtualmachines 资源,请将以下 Bicep 添加到模板。
resource symbolicname 'Microsoft.DevTestLab/labs/virtualmachines@2018-09-15' = {
parent: resourceSymbolicName
location: 'string'
name: 'string'
properties: {
allowClaim: bool
artifacts: [
{
artifactId: 'string'
artifactTitle: 'string'
deploymentStatusMessage: 'string'
installTime: 'string'
parameters: [
{
name: 'string'
value: 'string'
}
]
status: 'string'
vmExtensionStatusMessage: 'string'
}
]
createdDate: 'string'
customImageId: 'string'
dataDiskParameters: [
{
attachNewDataDiskOptions: {
diskName: 'string'
diskSizeGiB: int
diskType: 'string'
}
existingLabDiskId: 'string'
hostCaching: 'string'
}
]
disallowPublicIpAddress: bool
environmentId: 'string'
expirationDate: 'string'
galleryImageReference: {
offer: 'string'
osType: 'string'
publisher: 'string'
sku: 'string'
version: 'string'
}
isAuthenticationWithSshKey: bool
labSubnetName: 'string'
labVirtualNetworkId: 'string'
networkInterface: {
dnsName: 'string'
privateIpAddress: 'string'
publicIpAddress: 'string'
publicIpAddressId: 'string'
rdpAuthority: 'string'
sharedPublicIpAddressConfiguration: {
inboundNatRules: [
{
backendPort: int
frontendPort: int
transportProtocol: 'string'
}
]
}
sshAuthority: 'string'
subnetId: 'string'
virtualNetworkId: 'string'
}
notes: 'string'
ownerObjectId: 'string'
ownerUserPrincipalName: 'string'
password: 'string'
planId: 'string'
scheduleParameters: [
{
name: 'string'
properties: {
dailyRecurrence: {
time: 'string'
}
hourlyRecurrence: {
minute: int
}
notificationSettings: {
emailRecipient: 'string'
notificationLocale: 'string'
status: 'string'
timeInMinutes: int
webhookUrl: 'string'
}
status: 'string'
targetResourceId: 'string'
taskType: 'string'
timeZoneId: 'string'
weeklyRecurrence: {
time: 'string'
weekdays: [
'string'
]
}
}
tags: {
{customized property}: 'string'
}
}
]
size: 'string'
sshKey: 'string'
storageType: 'string'
userName: 'string'
}
tags: {
{customized property}: 'string'
}
}
属性值
Microsoft.DevTestLab/labs/virtualmachines
| Name |
Description |
Value |
| 位置 |
资源的位置。 |
字符串 |
| name |
资源名称 |
string (必需) |
| 父级 |
在 Bicep 中,可以为子资源指定父资源。 仅当子资源在父资源外部声明时,才需要添加此属性。
有关详细信息,请参阅 父资源外部的子资源。 |
类型资源的符号名称:实验室 |
| properties |
资源的属性。 |
LabVirtualMachineProperties (必需) |
| tags |
资源标记 |
标记名称和值的字典。 请参阅模板 中的 标记 |
ArtifactInstallProperties
| Name |
Description |
Value |
| artifactId |
项目的标识符。 |
字符串 |
| artifactTitle |
项目的标题。 |
字符串 |
| deploymentStatusMessage |
部署中的状态消息。 |
字符串 |
| installTime |
项目开始在虚拟机上安装的时间。 |
字符串 |
| parameters |
项目的参数。 |
ArtifactParameterProperties[] |
| 状态 |
项目的状态。 |
字符串 |
| vmExtensionStatusMessage |
虚拟机扩展的状态消息。 |
字符串 |
ArtifactParameterProperties
| Name |
Description |
Value |
| name |
项目参数的名称。 |
字符串 |
| value |
项目参数的值。 |
字符串 |
AttachNewDataDiskOptions
| Name |
Description |
Value |
| diskName |
要附加的磁盘的名称。 |
字符串 |
| diskSizeGiB |
要附加的磁盘的大小(以 Gibibytes 为单位)。 |
int |
| diskType |
磁盘的存储类型(即标准、高级)。 |
'Premium' 'Standard' 'StandardSSD' |
DataDiskProperties
| Name |
Description |
Value |
| attachNewDataDiskOptions |
指定用于将新磁盘附加到虚拟机的选项。 |
AttachNewDataDiskOptions |
| existingLabDiskId |
指定要附加到虚拟机的现有实验室磁盘 ID。 |
字符串 |
| hostCaching |
数据磁盘的缓存选项(例如 None、ReadOnly、ReadWrite)。 |
'None' 'ReadOnly' 'ReadWrite' |
DayDetails
| Name |
Description |
Value |
| time |
计划将发生当天的时间。 |
字符串 |
GalleryImageReference
| Name |
Description |
Value |
| 优惠 |
库映像的产品/服务。 |
字符串 |
| osType |
库映像的 OS 类型。 |
字符串 |
| 发布服务器 |
库映像的发布者。 |
字符串 |
| sku |
库映像的 SKU。 |
字符串 |
| 版本 |
库映像的版本。 |
字符串 |
HourDetails
| Name |
Description |
Value |
| minute |
计划将运行的小时分钟数。 |
int |
InboundNatRule
| Name |
Description |
Value |
| backendPort |
外部流量将重定向到的端口。 |
int |
| frontendPort |
入站连接的外部终结点端口。 可能的值介于 1 和 65535 之间,包括 1 和 65535。 如果未指定,将自动分配值。 |
int |
| transportProtocol |
终结点的传输协议。 |
'Tcp' 'Udp' |
LabVirtualMachineProperties
| Name |
Description |
Value |
| allowClaim |
指示其他用户是否可以获取虚拟机的所有权 |
bool |
| artifacts |
要安装在虚拟机上的项目。 |
ArtifactInstallProperties[] |
| createdDate |
虚拟机的创建日期。 |
字符串 |
| customImageId |
虚拟机的自定义映像标识符。 |
字符串 |
| dataDiskParameters |
创建后要附加到虚拟机的新磁盘或现有数据磁盘 |
DataDiskProperties[] |
| disallowPublicIpAddress |
指示是否在不使用公共 IP 地址的情况下创建虚拟机。 |
bool |
| environmentId |
包含此虚拟机的环境的资源 ID(如果有)。 |
字符串 |
| expirationDate |
VM 的到期日期。 |
字符串 |
| galleryImageReference |
虚拟机Microsoft Azure 市场映像参考。 |
GalleryImageReference |
| isAuthenticationWithSshKey |
指示此虚拟机是否使用 SSH 密钥进行身份验证。 |
bool |
| labSubnetName |
虚拟机的实验室子网名称。 |
字符串 |
| labVirtualNetworkId |
虚拟机的实验室虚拟网络标识符。 |
字符串 |
| networkInterface |
网络接口属性。 |
NetworkInterfaceProperties |
| notes |
虚拟机的说明。 |
字符串 |
| ownerObjectId |
虚拟机所有者的对象标识符。 |
字符串 |
| ownerUserPrincipalName |
虚拟机所有者的用户主体名称。 |
字符串 |
| 密码 |
虚拟机管理员的密码。 |
字符串 |
| planId |
与虚拟机映像关联的计划的 ID |
字符串 |
| scheduleParameters |
要创建的虚拟机计划 |
ScheduleCreationParameter[] |
| size |
虚拟机的大小。 |
字符串 |
| sshKey |
虚拟机管理员的 SSH 密钥。 |
字符串 |
| storageType |
要用于虚拟机的存储类型(即标准、高级)。 |
字符串 |
| userName |
虚拟机的用户名。 |
字符串 |
NetworkInterfaceProperties
| Name |
Description |
Value |
| dnsName |
DNS 名称。 |
字符串 |
| privateIpAddress |
专用 IP 地址。 |
字符串 |
| publicIpAddress |
公共 IP 地址。 |
字符串 |
| publicIpAddressId |
公共 IP 地址的资源 ID。 |
字符串 |
| rdpAuthority |
RdpAuthority 属性是服务器 DNS 主机名或 IP 地址,后跟 RDP(远程桌面协议)的服务端口号。 |
字符串 |
| sharedPublicIpAddressConfiguration |
用于跨多个虚拟机共享公共 IP 地址的配置。 |
SharedPublicIpAddressConfiguration |
| sshAuthority |
SshAuthority 属性是服务器 DNS 主机名或 IP 地址,后跟 SSH 的服务端口号。 |
字符串 |
| subnetId |
子网络的资源 ID。 |
字符串 |
| virtualNetworkId |
虚拟网络的资源 ID。 |
字符串 |
NotificationSettings
| Name |
Description |
Value |
| emailRecipient |
要向其发送通知的电子邮件收件人(可以是分号分隔电子邮件地址的列表)。 |
字符串 |
| notificationLocale |
发送通知时要使用的区域设置(不受支持的语言的回退为 EN)。 |
字符串 |
| 状态 |
如果为此计划启用了通知(即已启用,已禁用)。 |
'Disabled' 'Enabled' |
| timeInMinutes |
发送通知的事件之前的时间(以分钟为单位)。 |
int |
| webhookUrl |
通知将发送到的 Webhook URL。 |
字符串 |
ScheduleCreationParameter
ScheduleCreationParameterProperties
SharedPublicIpAddressConfiguration
WeekDetails
| Name |
Description |
Value |
| time |
计划将发生的一天的时间。 |
字符串 |
| weekdays |
计划设置的星期几(例如星期天、星期一、星期二等)。 |
string[] |
用法示例
Azure 快速入门示例
以下 Azure 快速入门模板 包含用于部署此资源类型的 Bicep 示例。
ARM 模板资源定义
可以使用目标操作部署 labs/virtualmachines 资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
若要创建 Microsoft.DevTestLab/labs/virtualmachines 资源,请将以下 JSON 添加到模板。
{
"type": "Microsoft.DevTestLab/labs/virtualmachines",
"apiVersion": "2018-09-15",
"name": "string",
"location": "string",
"properties": {
"allowClaim": "bool",
"artifacts": [
{
"artifactId": "string",
"artifactTitle": "string",
"deploymentStatusMessage": "string",
"installTime": "string",
"parameters": [
{
"name": "string",
"value": "string"
}
],
"status": "string",
"vmExtensionStatusMessage": "string"
}
],
"createdDate": "string",
"customImageId": "string",
"dataDiskParameters": [
{
"attachNewDataDiskOptions": {
"diskName": "string",
"diskSizeGiB": "int",
"diskType": "string"
},
"existingLabDiskId": "string",
"hostCaching": "string"
}
],
"disallowPublicIpAddress": "bool",
"environmentId": "string",
"expirationDate": "string",
"galleryImageReference": {
"offer": "string",
"osType": "string",
"publisher": "string",
"sku": "string",
"version": "string"
},
"isAuthenticationWithSshKey": "bool",
"labSubnetName": "string",
"labVirtualNetworkId": "string",
"networkInterface": {
"dnsName": "string",
"privateIpAddress": "string",
"publicIpAddress": "string",
"publicIpAddressId": "string",
"rdpAuthority": "string",
"sharedPublicIpAddressConfiguration": {
"inboundNatRules": [
{
"backendPort": "int",
"frontendPort": "int",
"transportProtocol": "string"
}
]
},
"sshAuthority": "string",
"subnetId": "string",
"virtualNetworkId": "string"
},
"notes": "string",
"ownerObjectId": "string",
"ownerUserPrincipalName": "string",
"password": "string",
"planId": "string",
"scheduleParameters": [
{
"name": "string",
"properties": {
"dailyRecurrence": {
"time": "string"
},
"hourlyRecurrence": {
"minute": "int"
},
"notificationSettings": {
"emailRecipient": "string",
"notificationLocale": "string",
"status": "string",
"timeInMinutes": "int",
"webhookUrl": "string"
},
"status": "string",
"targetResourceId": "string",
"taskType": "string",
"timeZoneId": "string",
"weeklyRecurrence": {
"time": "string",
"weekdays": [ "string" ]
}
},
"tags": {
"{customized property}": "string"
}
}
],
"size": "string",
"sshKey": "string",
"storageType": "string",
"userName": "string"
},
"tags": {
"{customized property}": "string"
}
}
属性值
Microsoft.DevTestLab/labs/virtualmachines
| Name |
Description |
Value |
| apiVersion |
API 版本 |
'2018-09-15' |
| 位置 |
资源的位置。 |
字符串 |
| name |
资源名称 |
string (必需) |
| properties |
资源的属性。 |
LabVirtualMachineProperties (必需) |
| tags |
资源标记 |
标记名称和值的字典。 请参阅模板 中的 标记 |
| 类型 |
资源类型 |
'Microsoft.DevTestLab/labs/virtualmachines' |
ArtifactInstallProperties
| Name |
Description |
Value |
| artifactId |
项目的标识符。 |
字符串 |
| artifactTitle |
项目的标题。 |
字符串 |
| deploymentStatusMessage |
部署中的状态消息。 |
字符串 |
| installTime |
项目开始在虚拟机上安装的时间。 |
字符串 |
| parameters |
项目的参数。 |
ArtifactParameterProperties[] |
| 状态 |
项目的状态。 |
字符串 |
| vmExtensionStatusMessage |
虚拟机扩展的状态消息。 |
字符串 |
ArtifactParameterProperties
| Name |
Description |
Value |
| name |
项目参数的名称。 |
字符串 |
| value |
项目参数的值。 |
字符串 |
AttachNewDataDiskOptions
| Name |
Description |
Value |
| diskName |
要附加的磁盘的名称。 |
字符串 |
| diskSizeGiB |
要附加的磁盘的大小(以 Gibibytes 为单位)。 |
int |
| diskType |
磁盘的存储类型(即标准、高级)。 |
'Premium' 'Standard' 'StandardSSD' |
DataDiskProperties
| Name |
Description |
Value |
| attachNewDataDiskOptions |
指定用于将新磁盘附加到虚拟机的选项。 |
AttachNewDataDiskOptions |
| existingLabDiskId |
指定要附加到虚拟机的现有实验室磁盘 ID。 |
字符串 |
| hostCaching |
数据磁盘的缓存选项(例如 None、ReadOnly、ReadWrite)。 |
'None' 'ReadOnly' 'ReadWrite' |
DayDetails
| Name |
Description |
Value |
| time |
计划将发生当天的时间。 |
字符串 |
GalleryImageReference
| Name |
Description |
Value |
| 优惠 |
库映像的产品/服务。 |
字符串 |
| osType |
库映像的 OS 类型。 |
字符串 |
| 发布服务器 |
库映像的发布者。 |
字符串 |
| sku |
库映像的 SKU。 |
字符串 |
| 版本 |
库映像的版本。 |
字符串 |
HourDetails
| Name |
Description |
Value |
| minute |
计划将运行的小时分钟数。 |
int |
InboundNatRule
| Name |
Description |
Value |
| backendPort |
外部流量将重定向到的端口。 |
int |
| frontendPort |
入站连接的外部终结点端口。 可能的值介于 1 和 65535 之间,包括 1 和 65535。 如果未指定,将自动分配值。 |
int |
| transportProtocol |
终结点的传输协议。 |
'Tcp' 'Udp' |
LabVirtualMachineProperties
| Name |
Description |
Value |
| allowClaim |
指示其他用户是否可以获取虚拟机的所有权 |
bool |
| artifacts |
要安装在虚拟机上的项目。 |
ArtifactInstallProperties[] |
| createdDate |
虚拟机的创建日期。 |
字符串 |
| customImageId |
虚拟机的自定义映像标识符。 |
字符串 |
| dataDiskParameters |
创建后要附加到虚拟机的新磁盘或现有数据磁盘 |
DataDiskProperties[] |
| disallowPublicIpAddress |
指示是否在不使用公共 IP 地址的情况下创建虚拟机。 |
bool |
| environmentId |
包含此虚拟机的环境的资源 ID(如果有)。 |
字符串 |
| expirationDate |
VM 的到期日期。 |
字符串 |
| galleryImageReference |
虚拟机Microsoft Azure 市场映像参考。 |
GalleryImageReference |
| isAuthenticationWithSshKey |
指示此虚拟机是否使用 SSH 密钥进行身份验证。 |
bool |
| labSubnetName |
虚拟机的实验室子网名称。 |
字符串 |
| labVirtualNetworkId |
虚拟机的实验室虚拟网络标识符。 |
字符串 |
| networkInterface |
网络接口属性。 |
NetworkInterfaceProperties |
| notes |
虚拟机的说明。 |
字符串 |
| ownerObjectId |
虚拟机所有者的对象标识符。 |
字符串 |
| ownerUserPrincipalName |
虚拟机所有者的用户主体名称。 |
字符串 |
| 密码 |
虚拟机管理员的密码。 |
字符串 |
| planId |
与虚拟机映像关联的计划的 ID |
字符串 |
| scheduleParameters |
要创建的虚拟机计划 |
ScheduleCreationParameter[] |
| size |
虚拟机的大小。 |
字符串 |
| sshKey |
虚拟机管理员的 SSH 密钥。 |
字符串 |
| storageType |
要用于虚拟机的存储类型(即标准、高级)。 |
字符串 |
| userName |
虚拟机的用户名。 |
字符串 |
NetworkInterfaceProperties
| Name |
Description |
Value |
| dnsName |
DNS 名称。 |
字符串 |
| privateIpAddress |
专用 IP 地址。 |
字符串 |
| publicIpAddress |
公共 IP 地址。 |
字符串 |
| publicIpAddressId |
公共 IP 地址的资源 ID。 |
字符串 |
| rdpAuthority |
RdpAuthority 属性是服务器 DNS 主机名或 IP 地址,后跟 RDP(远程桌面协议)的服务端口号。 |
字符串 |
| sharedPublicIpAddressConfiguration |
用于跨多个虚拟机共享公共 IP 地址的配置。 |
SharedPublicIpAddressConfiguration |
| sshAuthority |
SshAuthority 属性是服务器 DNS 主机名或 IP 地址,后跟 SSH 的服务端口号。 |
字符串 |
| subnetId |
子网络的资源 ID。 |
字符串 |
| virtualNetworkId |
虚拟网络的资源 ID。 |
字符串 |
NotificationSettings
| Name |
Description |
Value |
| emailRecipient |
要向其发送通知的电子邮件收件人(可以是分号分隔电子邮件地址的列表)。 |
字符串 |
| notificationLocale |
发送通知时要使用的区域设置(不受支持的语言的回退为 EN)。 |
字符串 |
| 状态 |
如果为此计划启用了通知(即已启用,已禁用)。 |
'Disabled' 'Enabled' |
| timeInMinutes |
发送通知的事件之前的时间(以分钟为单位)。 |
int |
| webhookUrl |
通知将发送到的 Webhook URL。 |
字符串 |
ScheduleCreationParameter
ScheduleCreationParameterProperties
SharedPublicIpAddressConfiguration
WeekDetails
| Name |
Description |
Value |
| time |
计划将发生的一天的时间。 |
字符串 |
| weekdays |
计划设置的星期几(例如星期天、星期一、星期二等)。 |
string[] |
用法示例
Azure 快速入门模板
以下 Azure 快速入门模板 部署此资源类型。
可以使用目标操作部署 labs/virtualmachines 资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
若要创建 Microsoft.DevTestLab/labs/virtualmachines 资源,请将以下 Terraform 添加到模板。
resource "azapi_resource" "symbolicname" {
type = "Microsoft.DevTestLab/labs/virtualmachines@2018-09-15"
name = "string"
parent_id = "string"
location = "string"
tags = {
{customized property} = "string"
}
body = {
properties = {
allowClaim = bool
artifacts = [
{
artifactId = "string"
artifactTitle = "string"
deploymentStatusMessage = "string"
installTime = "string"
parameters = [
{
name = "string"
value = "string"
}
]
status = "string"
vmExtensionStatusMessage = "string"
}
]
createdDate = "string"
customImageId = "string"
dataDiskParameters = [
{
attachNewDataDiskOptions = {
diskName = "string"
diskSizeGiB = int
diskType = "string"
}
existingLabDiskId = "string"
hostCaching = "string"
}
]
disallowPublicIpAddress = bool
environmentId = "string"
expirationDate = "string"
galleryImageReference = {
offer = "string"
osType = "string"
publisher = "string"
sku = "string"
version = "string"
}
isAuthenticationWithSshKey = bool
labSubnetName = "string"
labVirtualNetworkId = "string"
networkInterface = {
dnsName = "string"
privateIpAddress = "string"
publicIpAddress = "string"
publicIpAddressId = "string"
rdpAuthority = "string"
sharedPublicIpAddressConfiguration = {
inboundNatRules = [
{
backendPort = int
frontendPort = int
transportProtocol = "string"
}
]
}
sshAuthority = "string"
subnetId = "string"
virtualNetworkId = "string"
}
notes = "string"
ownerObjectId = "string"
ownerUserPrincipalName = "string"
password = "string"
planId = "string"
scheduleParameters = [
{
name = "string"
properties = {
dailyRecurrence = {
time = "string"
}
hourlyRecurrence = {
minute = int
}
notificationSettings = {
emailRecipient = "string"
notificationLocale = "string"
status = "string"
timeInMinutes = int
webhookUrl = "string"
}
status = "string"
targetResourceId = "string"
taskType = "string"
timeZoneId = "string"
weeklyRecurrence = {
time = "string"
weekdays = [
"string"
]
}
}
tags = {
{customized property} = "string"
}
}
]
size = "string"
sshKey = "string"
storageType = "string"
userName = "string"
}
}
}
属性值
Microsoft.DevTestLab/labs/virtualmachines
| Name |
Description |
Value |
| 位置 |
资源的位置。 |
字符串 |
| name |
资源名称 |
string (必需) |
| parent_id |
此资源的父资源的 ID。 |
类型资源的 ID:实验室 |
| properties |
资源的属性。 |
LabVirtualMachineProperties (必需) |
| tags |
资源标记 |
标记名称和值的字典。 |
| 类型 |
资源类型 |
"Microsoft.DevTestLab/labs/virtualmachines@2018-09-15" |
ArtifactInstallProperties
| Name |
Description |
Value |
| artifactId |
项目的标识符。 |
字符串 |
| artifactTitle |
项目的标题。 |
字符串 |
| deploymentStatusMessage |
部署中的状态消息。 |
字符串 |
| installTime |
项目开始在虚拟机上安装的时间。 |
字符串 |
| parameters |
项目的参数。 |
ArtifactParameterProperties[] |
| 状态 |
项目的状态。 |
字符串 |
| vmExtensionStatusMessage |
虚拟机扩展的状态消息。 |
字符串 |
ArtifactParameterProperties
| Name |
Description |
Value |
| name |
项目参数的名称。 |
字符串 |
| value |
项目参数的值。 |
字符串 |
AttachNewDataDiskOptions
| Name |
Description |
Value |
| diskName |
要附加的磁盘的名称。 |
字符串 |
| diskSizeGiB |
要附加的磁盘的大小(以 Gibibytes 为单位)。 |
int |
| diskType |
磁盘的存储类型(即标准、高级)。 |
'Premium' 'Standard' 'StandardSSD' |
DataDiskProperties
| Name |
Description |
Value |
| attachNewDataDiskOptions |
指定用于将新磁盘附加到虚拟机的选项。 |
AttachNewDataDiskOptions |
| existingLabDiskId |
指定要附加到虚拟机的现有实验室磁盘 ID。 |
字符串 |
| hostCaching |
数据磁盘的缓存选项(例如 None、ReadOnly、ReadWrite)。 |
'None' 'ReadOnly' 'ReadWrite' |
DayDetails
| Name |
Description |
Value |
| time |
计划将发生当天的时间。 |
字符串 |
GalleryImageReference
| Name |
Description |
Value |
| 优惠 |
库映像的产品/服务。 |
字符串 |
| osType |
库映像的 OS 类型。 |
字符串 |
| 发布服务器 |
库映像的发布者。 |
字符串 |
| sku |
库映像的 SKU。 |
字符串 |
| 版本 |
库映像的版本。 |
字符串 |
HourDetails
| Name |
Description |
Value |
| minute |
计划将运行的小时分钟数。 |
int |
InboundNatRule
| Name |
Description |
Value |
| backendPort |
外部流量将重定向到的端口。 |
int |
| frontendPort |
入站连接的外部终结点端口。 可能的值介于 1 和 65535 之间,包括 1 和 65535。 如果未指定,将自动分配值。 |
int |
| transportProtocol |
终结点的传输协议。 |
'Tcp' 'Udp' |
LabVirtualMachineProperties
| Name |
Description |
Value |
| allowClaim |
指示其他用户是否可以获取虚拟机的所有权 |
bool |
| artifacts |
要安装在虚拟机上的项目。 |
ArtifactInstallProperties[] |
| createdDate |
虚拟机的创建日期。 |
字符串 |
| customImageId |
虚拟机的自定义映像标识符。 |
字符串 |
| dataDiskParameters |
创建后要附加到虚拟机的新磁盘或现有数据磁盘 |
DataDiskProperties[] |
| disallowPublicIpAddress |
指示是否在不使用公共 IP 地址的情况下创建虚拟机。 |
bool |
| environmentId |
包含此虚拟机的环境的资源 ID(如果有)。 |
字符串 |
| expirationDate |
VM 的到期日期。 |
字符串 |
| galleryImageReference |
虚拟机Microsoft Azure 市场映像参考。 |
GalleryImageReference |
| isAuthenticationWithSshKey |
指示此虚拟机是否使用 SSH 密钥进行身份验证。 |
bool |
| labSubnetName |
虚拟机的实验室子网名称。 |
字符串 |
| labVirtualNetworkId |
虚拟机的实验室虚拟网络标识符。 |
字符串 |
| networkInterface |
网络接口属性。 |
NetworkInterfaceProperties |
| notes |
虚拟机的说明。 |
字符串 |
| ownerObjectId |
虚拟机所有者的对象标识符。 |
字符串 |
| ownerUserPrincipalName |
虚拟机所有者的用户主体名称。 |
字符串 |
| 密码 |
虚拟机管理员的密码。 |
字符串 |
| planId |
与虚拟机映像关联的计划的 ID |
字符串 |
| scheduleParameters |
要创建的虚拟机计划 |
ScheduleCreationParameter[] |
| size |
虚拟机的大小。 |
字符串 |
| sshKey |
虚拟机管理员的 SSH 密钥。 |
字符串 |
| storageType |
要用于虚拟机的存储类型(即标准、高级)。 |
字符串 |
| userName |
虚拟机的用户名。 |
字符串 |
NetworkInterfaceProperties
| Name |
Description |
Value |
| dnsName |
DNS 名称。 |
字符串 |
| privateIpAddress |
专用 IP 地址。 |
字符串 |
| publicIpAddress |
公共 IP 地址。 |
字符串 |
| publicIpAddressId |
公共 IP 地址的资源 ID。 |
字符串 |
| rdpAuthority |
RdpAuthority 属性是服务器 DNS 主机名或 IP 地址,后跟 RDP(远程桌面协议)的服务端口号。 |
字符串 |
| sharedPublicIpAddressConfiguration |
用于跨多个虚拟机共享公共 IP 地址的配置。 |
SharedPublicIpAddressConfiguration |
| sshAuthority |
SshAuthority 属性是服务器 DNS 主机名或 IP 地址,后跟 SSH 的服务端口号。 |
字符串 |
| subnetId |
子网络的资源 ID。 |
字符串 |
| virtualNetworkId |
虚拟网络的资源 ID。 |
字符串 |
NotificationSettings
| Name |
Description |
Value |
| emailRecipient |
要向其发送通知的电子邮件收件人(可以是分号分隔电子邮件地址的列表)。 |
字符串 |
| notificationLocale |
发送通知时要使用的区域设置(不受支持的语言的回退为 EN)。 |
字符串 |
| 状态 |
如果为此计划启用了通知(即已启用,已禁用)。 |
'Disabled' 'Enabled' |
| timeInMinutes |
发送通知的事件之前的时间(以分钟为单位)。 |
int |
| webhookUrl |
通知将发送到的 Webhook URL。 |
字符串 |
ScheduleCreationParameter
ScheduleCreationParameterProperties
SharedPublicIpAddressConfiguration
WeekDetails
| Name |
Description |
Value |
| time |
计划将发生的一天的时间。 |
字符串 |
| weekdays |
计划设置的星期几(例如星期天、星期一、星期二等)。 |
string[] |
用法示例
在开发测试实验室中部署虚拟机的基本示例。
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
}
}
provider "azapi" {
skip_provider_registration = false
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "westeurope"
}
variable "vm_password" {
type = string
description = "The password for the DevTest Lab virtual machine"
sensitive = true
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}
resource "azapi_resource" "lab" {
type = "Microsoft.DevTestLab/labs@2018-09-15"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
properties = {
labStorageType = "Premium"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
data "azapi_resource_id" "virtualNetwork" {
type = "Microsoft.Network/virtualNetworks@2023-04-01"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
}
data "azapi_resource_id" "subnet" {
type = "Microsoft.Network/virtualNetworks/subnets@2023-04-01"
parent_id = data.azapi_resource_id.virtualNetwork.id
name = "${var.resource_name}Subnet"
}
resource "azapi_resource" "virtualNetwork" {
type = "Microsoft.DevTestLab/labs/virtualNetworks@2018-09-15"
parent_id = azapi_resource.lab.id
name = var.resource_name
body = {
properties = {
description = ""
subnetOverrides = [
{
labSubnetName = data.azapi_resource_id.subnet.name
resourceId = data.azapi_resource_id.subnet.id
useInVmCreationPermission = "Allow"
usePublicIpAddressPermission = "Allow"
},
]
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "virtualMachine" {
type = "Microsoft.DevTestLab/labs/virtualMachines@2018-09-15"
parent_id = azapi_resource.lab.id
name = var.resource_name
location = var.location
body = {
properties = {
allowClaim = true
disallowPublicIpAddress = false
galleryImageReference = {
offer = "WindowsServer"
osType = "Windows"
publisher = "MicrosoftWindowsServer"
sku = "2012-Datacenter"
version = "latest"
}
isAuthenticationWithSshKey = false
labSubnetName = data.azapi_resource_id.subnet.name
labVirtualNetworkId = azapi_resource.virtualNetwork.id
networkInterface = {
}
notes = ""
osType = "Windows"
password = var.vm_password
size = "Standard_F2"
storageType = "Standard"
userName = "acct5stU5er"
}
}
ignore_casing = true
schema_validation_enabled = false
response_export_values = ["*"]
}