Proximity Placement Group should have associated VMs

Low Azure General proximityplacementgroups-proximity-placement-group

Applies to

  • Microsoft.Compute/proximityPlacementGroups

What CGPulse checks

A resource passes this rule when virtualMachinesCount must be greater than 0. Anything else is reported as a finding with the evaluated property value attached as evidence.

How to fix it

Associate VMs with the proximity placement group or remove unused groups to reduce clutter. In Azure Portal: Proximity Placement Group > Virtual Machines. See: https://learn.microsoft.com/en-us/azure/virtual-machines/co-location

CLI

az ppg show --ids "{id}" --query "virtualMachines"

Bicep

// Associate a VM with a proximity placement group at creation:
resource vm 'Microsoft.Compute/virtualMachines@2024-03-01' = {{
  name: 'vm-example'
  location: location
  properties: {{
    proximityPlacementGroup: {{
      id: '<ppg-resource-id>'
    }}
    hardwareProfile: {{ vmSize: 'Standard_D2s_v3' }}
  }}
}}

Terraform

# Associate a VM with a proximity placement group:
resource "azurerm_linux_virtual_machine" "{name}" {
  name                            = "vm-example"
  resource_group_name             = "{rg}"
  location                        = var.location
  size                            = "Standard_D2s_v3"
  proximity_placement_group_id    = "<ppg-id>"
  admin_username                  = "adminuser"
  network_interface_ids           = ["<nic-id>"]

  os_disk {
    caching              = "ReadWrite"
    storage_account_type = "Standard_LRS"
  }

  source_image_reference {
    publisher = "Canonical"
    offer     = "0001-com-ubuntu-server-jammy"
    sku       = "22_04-lts"
    version   = "latest"
  }
}

Compliance frameworks

Is your environment compliant with this rule?

CGPulse checks it — and 621 others — against your Azure and AWS accounts with read-only access.

Run a free scan

Related Azure rules

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.