Search code examples
azureazure-virtual-machineazure-backup-vault

Azure Virtual Machine BackUp Rest API


We are looking to verify if backups are configured for Azure VMs. Using the following REST API https://learn.microsoft.com/en-us/rest/api/compute/virtual-machines/instance-view, we were able to retrieve the information that we need for Linux VM only Ex output:

{
  "computerName": "vm01",
  "osName": "ubuntu",
  "osVersion": "20.04",
  "vmAgent": {
  "vmAgentVersion": "2.5.0.2",
  "statuses": [
    {
      "code": "ProvisioningState/succeeded",
      "level": "Info",
      "displayStatus": "Ready",
      "message": "Guest Agent is running",
      "time": "2021-11-17T13:52:54+00:00"
    }
  ],
  "extensionHandlers": [
    {
      "type": "Microsoft.Azure.RecoveryServices.VMSnapshotLinux",
      "typeHandlerVersion": "1.0.9187.0",
      "status": {
        "code": "ProvisioningState/succeeded",
        "level": "Info",
        "displayStatus": "Ready",
        "message": "Plugin enabled"
      }
    }
  ]
},
...
}

Windows Virtual Machine

{
  "computerName": "vm02",
  "osName": "Windows Server 2019 Datacenter",
  "osVersion": "10.0.17763.2300",
  "vmAgent": {
    "vmAgentVersion": "2.7.41491.1029",
    "statuses": [
      ...
    ]
  },
  "disks": [
    ...
  ],
  "bootDiagnostics": {},
  "hyperVGeneration": "V1",
  "statuses": [
   ...
  ]
}

under extensionHandlers we have Microsoft.Azure.RecoveryServices.VMSnapshotLinux, but there is no equivalent on Windows Virtual Machines. Is there any way to achieve this?

We are not using this approach https://learn.microsoft.com/en-us/azure/backup/backup-azure-arm-userestapi-backupazurevms#discover-unprotected-azure-vms as we need to perform a bulk verification and the vault information is not avaialable.


Solution

  • I checked the API on a Windows VM in my environment. I got the same output as you after enabling the Backup for the VM ( even after some time).

    enter image description here

    So , the solution what I found is after starting a backup by clicking on backup now, the extension gets visible.

    enter image description here

    Output:

    enter image description here