Microsoft.StandbyPool 待命VirtualMachinePools 2024-03-01-preview

Bicep 資源定義

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

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

資源格式

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

resource symbolicname 'Microsoft.StandbyPool/standbyVirtualMachinePools@2024-03-01-preview' = {
  location: 'string'
  name: 'string'
  properties: {
    attachedVirtualMachineScaleSetId: 'string'
    elasticityProfile: {
      maxReadyCapacity: int
      minReadyCapacity: int
    }
    virtualMachineState: 'string'
  }
  tags: {
    {customized property}: 'string'
  }
}

屬性值

Microsoft.StandbyPool/standbyVirtualMachinePools

名字 描述 價值
位置 資源所在的地理位置 字串 (必要)
名字 資源名稱 字串

約束:
模式 = ^[a-zA-Z0-9-]{3,24}$ (必要)
性能 此資源的資源特定屬性。 StandbyVirtualMachinePoolResourceProperties
標籤 資源標籤 標記名稱和值的字典。 請參閱範本中的 標籤

StandbyVirtualMachinePoolElasticityProfile

名字 描述 價值
maxReadyCapacity 指定待命虛擬機集區中的虛擬機數目上限。 int

約束:
最小值 = 0
最大值 = 2000 (必要)
minReadyCapacity 指定待命虛擬機集區中所需的虛擬機數目下限。 MinReadyCapacity 不能超過 MaxReadyCapacity。 int

約束:
最小值 = 0
最大值 = 2000

StandbyVirtualMachinePoolResourceProperties

名字 描述 價值
attachedVirtualMachineScaleSetId 指定集區所連結之虛擬機擴展集的完整資源識別碼。 字串
elasticityProfile 指定待命虛擬機集區的彈性配置檔。 StandbyVirtualMachinePoolElasticityProfile
virtualMachineState 指定集區中虛擬機的所需狀態。 'Deallocated'
'Running' (必要)

TrackedResourceTags

名字 描述 價值

ARM 樣本資源定義

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

使用範例

資源格式

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

{
  "type": "Microsoft.StandbyPool/standbyVirtualMachinePools",
  "apiVersion": "2024-03-01-preview",
  "name": "string",
  "location": "string",
  "properties": {
    "attachedVirtualMachineScaleSetId": "string",
    "elasticityProfile": {
      "maxReadyCapacity": "int",
      "minReadyCapacity": "int"
    },
    "virtualMachineState": "string"
  },
  "tags": {
    "{customized property}": "string"
  }
}

屬性值

Microsoft.StandbyPool/standbyVirtualMachinePools

名字 描述 價值
apiVersion API 版本 '2024-03-01-preview'
位置 資源所在的地理位置 字串 (必要)
名字 資源名稱 字串

約束:
模式 = ^[a-zA-Z0-9-]{3,24}$ (必要)
性能 此資源的資源特定屬性。 StandbyVirtualMachinePoolResourceProperties
標籤 資源標籤 標記名稱和值的字典。 請參閱範本中的 標籤
型別 資源類型 'Microsoft.StandbyPool/standbyVirtualMachinePools'

StandbyVirtualMachinePoolElasticityProfile

名字 描述 價值
maxReadyCapacity 指定待命虛擬機集區中的虛擬機數目上限。 int

約束:
最小值 = 0
最大值 = 2000 (必要)
minReadyCapacity 指定待命虛擬機集區中所需的虛擬機數目下限。 MinReadyCapacity 不能超過 MaxReadyCapacity。 int

約束:
最小值 = 0
最大值 = 2000

StandbyVirtualMachinePoolResourceProperties

名字 描述 價值
attachedVirtualMachineScaleSetId 指定集區所連結之虛擬機擴展集的完整資源識別碼。 字串
elasticityProfile 指定待命虛擬機集區的彈性配置檔。 StandbyVirtualMachinePoolElasticityProfile
virtualMachineState 指定集區中虛擬機的所需狀態。 'Deallocated'
'Running' (必要)

TrackedResourceTags

名字 描述 價值

Terraform (AzAPI 提供者) 資源定義

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

  • 資源團體 關於每個 API 版本變更屬性的清單,請參見 變更日誌。

使用範例

Terraform 範例

部署虛擬機器擴展集 Microsoft 待命集區的基本範例。

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}

provider "azapi" {
  skip_provider_registration = false
}

provider "azurerm" {
  features {}
}

variable "resource_name" {
  type    = string
  default = "acctest0001"
}

variable "location" {
  type    = string
  default = "eastus"
}


resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = "${var.resource_name}-rg"
  location = var.location
}

resource "azapi_resource" "virtualNetwork" {
  type      = "Microsoft.Network/virtualNetworks@2022-07-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = "${var.resource_name}-vnet"
  location  = var.location
  body = {
    properties = {
      addressSpace = {
        addressPrefixes = [
          "10.0.0.0/16",
        ]
      }
      dhcpOptions = {
        dnsServers = [
        ]
      }
      subnets = [
      ]
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
  lifecycle {
    ignore_changes = [body.properties.subnets]
  }
}

resource "azapi_resource" "subnet" {
  type      = "Microsoft.Network/virtualNetworks/subnets@2022-07-01"
  parent_id = azapi_resource.virtualNetwork.id
  name      = "${var.resource_name}-subnet"
  body = {
    properties = {
      addressPrefix = "10.0.2.0/24"
      delegations = [
      ]
      privateEndpointNetworkPolicies    = "Enabled"
      privateLinkServiceNetworkPolicies = "Enabled"
      serviceEndpointPolicies = [
      ]
      serviceEndpoints = [
      ]
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "virtualMachineScaleSet" {
  type      = "Microsoft.Compute/virtualMachineScaleSets@2023-03-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = "${var.resource_name}-vmss"
  location  = var.location
  body = {
    properties = {
      additionalCapabilities = {
      }
      orchestrationMode        = "Flexible"
      platformFaultDomainCount = 1
      singlePlacementGroup     = false
      upgradePolicy = {
        mode = "Manual"
      }
      virtualMachineProfile = {
        diagnosticsProfile = {
          bootDiagnostics = {
            enabled    = false
            storageUri = ""
          }
        }
        extensionProfile = {
          extensionsTimeBudget = "PT1H30M"
        }
        networkProfile = {
          networkApiVersion = "2022-07-01"
          networkInterfaceConfigurations = [
            {
              name = "example"
              properties = {
                dnsSettings = {
                  dnsServers = [
                  ]
                }
                enableAcceleratedNetworking = false
                enableIPForwarding          = false
                ipConfigurations = [
                  {
                    name = "internal"
                    properties = {
                      applicationGatewayBackendAddressPools = [
                      ]
                      applicationSecurityGroups = [
                      ]
                      loadBalancerBackendAddressPools = [
                      ]
                      primary                 = true
                      privateIPAddressVersion = "IPv4"
                      subnet = {
                        id = azapi_resource.subnet.id
                      }
                    }
                  },
                ]
                primary = true
              }
            },
          ]
        }
        osProfile = {
          adminUsername      = "adminuser"
          computerNamePrefix = var.resource_name
          linuxConfiguration = {
            disablePasswordAuthentication = true
            provisionVMAgent              = true
            ssh = {
              publicKeys = [
                {
                  keyData = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com"
                  path    = "/home/adminuser/.ssh/authorized_keys"
                },
              ]
            }
          }
          secrets = [
          ]
        }
        priority = "Regular"
        storageProfile = {
          dataDisks = [
          ]
          imageReference = {
            offer     = "UbuntuServer"
            publisher = "Canonical"
            sku       = "16.04-LTS"
            version   = "latest"
          }
          osDisk = {
            caching      = "ReadWrite"
            createOption = "FromImage"
            managedDisk = {
              storageAccountType = "Standard_LRS"
            }
            osType                  = "Linux"
            writeAcceleratorEnabled = false
          }
        }
      }
    }
    sku = {
      capacity = 1
      name     = "Standard_F2"
      tier     = "Standard"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

data "azurerm_subscription" "primary" {}

data "azurerm_role_definition" "vm-contributor" {
  name = "Virtual Machine Contributor"
}

data "azurerm_role_definition" "nw-contributor" {
  name = "Network Contributor"
}

data "azurerm_role_definition" "mi-contributor" {
  name = "Managed Identity Contributor"
}

data "azuread_service_principal" "test" {
  display_name = "Standby Pool Resource Provider"
}

resource "azurerm_role_assignment" "vm-contributor" {
  scope              = azapi_resource.resourceGroup.id
  role_definition_id = "${data.azurerm_subscription.primary.id}${data.azurerm_role_definition.vm-contributor.id}"
  principal_id       = data.azuread_service_principal.test.object_id
}

resource "azurerm_role_assignment" "nw-contributor" {
  scope              = azapi_resource.resourceGroup.id
  role_definition_id = "${data.azurerm_subscription.primary.id}${data.azurerm_role_definition.nw-contributor.id}"
  principal_id       = data.azuread_service_principal.test.object_id
}

resource "azurerm_role_assignment" "mi-contributor" {
  scope              = azapi_resource.resourceGroup.id
  role_definition_id = "${data.azurerm_subscription.primary.id}${data.azurerm_role_definition.mi-contributor.id}"
  principal_id       = data.azuread_service_principal.test.object_id
}

resource "azapi_resource" "standbyVirtualMachinePool" {
  type      = "Microsoft.StandbyPool/standbyVirtualMachinePools@2025-03-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = "${var.resource_name}-pool"
  location  = var.location

  body = {
    properties = {
      attachedVirtualMachineScaleSetId = azapi_resource.virtualMachineScaleSet.id
      elasticityProfile = {
        maxReadyCapacity = 2
        minReadyCapacity = 1
      }
      virtualMachineState = "Running"
    }
  }
  schema_validation_enabled = false
  ignore_casing             = false
  ignore_missing_property   = false

  depends_on = [
    azurerm_role_assignment.vm-contributor,
    azurerm_role_assignment.nw-contributor,
    azurerm_role_assignment.mi-contributor,
  ]
}

資源格式

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

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.StandbyPool/standbyVirtualMachinePools@2024-03-01-preview"
  name = "string"
  parent_id = "string"
  location = "string"
  tags = {
    {customized property} = "string"
  }
  body = {
    properties = {
      attachedVirtualMachineScaleSetId = "string"
      elasticityProfile = {
        maxReadyCapacity = int
        minReadyCapacity = int
      }
      virtualMachineState = "string"
    }
  }
}

屬性值

Microsoft.StandbyPool/standbyVirtualMachinePools

名字 描述 價值
位置 資源所在的地理位置 字串 (必要)
名字 資源名稱 字串

約束:
模式 = ^[a-zA-Z0-9-]{3,24}$ (必要)
性能 此資源的資源特定屬性。 StandbyVirtualMachinePoolResourceProperties
標籤 資源標籤 標記名稱和值的字典。
型別 資源類型 “Microsoft.StandbyPool/standbyVirtualMachinePools@2024-03-01-preview”

StandbyVirtualMachinePoolElasticityProfile

名字 描述 價值
maxReadyCapacity 指定待命虛擬機集區中的虛擬機數目上限。 int

約束:
最小值 = 0
最大值 = 2000 (必要)
minReadyCapacity 指定待命虛擬機集區中所需的虛擬機數目下限。 MinReadyCapacity 不能超過 MaxReadyCapacity。 int

約束:
最小值 = 0
最大值 = 2000

StandbyVirtualMachinePoolResourceProperties

名字 描述 價值
attachedVirtualMachineScaleSetId 指定集區所連結之虛擬機擴展集的完整資源識別碼。 字串
elasticityProfile 指定待命虛擬機集區的彈性配置檔。 StandbyVirtualMachinePoolElasticityProfile
virtualMachineState 指定集區中虛擬機的所需狀態。 'Deallocated'
'Running' (必要)

TrackedResourceTags

名字 描述 價值