Partilhar via


Virtual Machines - Instance View

Retrieves information about the run-time state of a virtual machine.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView?api-version=2024-07-01

URI Parameters

Name In Required Type Description
resourceGroupName
path True

string

The name of the resource group.

subscriptionId
path True

string

Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

vmName
path True

string

The name of the virtual machine.

api-version
query True

string

Client Api Version.

Responses

Name Type Description
200 OK

VirtualMachineInstanceView

OK

Other Status Codes

CloudError

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Get instance view of a virtual machine placed on a dedicated host group through automatic placement.
Get Virtual Machine Instance View.

Get instance view of a virtual machine placed on a dedicated host group through automatic placement.

Sample request

GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/instanceView?api-version=2024-07-01

Sample response

{
  "computerName": "myVM",
  "osName": "Windows Server 2016 Datacenter",
  "osVersion": "Microsoft Windows NT 10.0.14393.0",
  "vmAgent": {
    "vmAgentVersion": "2.7.41491.949",
    "statuses": [
      {
        "code": "ProvisioningState/succeeded",
        "level": "Info",
        "displayStatus": "Ready",
        "message": "GuestAgent is running and accepting new configurations.",
        "time": "2024-07-01T23:11:22+00:00"
      }
    ]
  },
  "disks": [
    {
      "name": "myOsDisk",
      "statuses": [
        {
          "code": "ProvisioningState/succeeded",
          "level": "Info",
          "displayStatus": "Provisioning succeeded",
          "time": "2024-07-01T21:29:47.477089+00:00"
        }
      ]
    }
  ],
  "hyperVGeneration": "V1",
  "assignedHost": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/hostGroups/myHostGroup/hosts/myHost",
  "statuses": [
    {
      "code": "ProvisioningState/succeeded",
      "level": "Info",
      "displayStatus": "Provisioning succeeded",
      "time": "2024-07-01T21:30:12.8051917+00:00"
    },
    {
      "code": "PowerState/running",
      "level": "Info",
      "displayStatus": "VM running"
    }
  ]
}

Get Virtual Machine Instance View.

Sample request

GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/instanceView?api-version=2024-07-01

Sample response

{
  "platformUpdateDomain": 1,
  "platformFaultDomain": 1,
  "computerName": "myVM",
  "osName": "Windows Server 2016 Datacenter",
  "osVersion": "Microsoft Windows NT 10.0.14393.0",
  "vmAgent": {
    "vmAgentVersion": "2.7.41491.949",
    "statuses": [
      {
        "code": "ProvisioningState/succeeded",
        "level": "Info",
        "displayStatus": "Ready",
        "message": "GuestAgent is running and accepting new configurations.",
        "time": "2019-10-14T23:11:22+00:00"
      }
    ],
    "extensionHandlers": [
      {
        "type": "Microsoft.Azure.Security.IaaSAntimalware",
        "typeHandlerVersion": "1.5.5.9",
        "status": {
          "code": "ProvisioningState/succeeded",
          "level": "Info",
          "displayStatus": "Ready"
        }
      }
    ]
  },
  "disks": [
    {
      "name": "myOsDisk",
      "statuses": [
        {
          "code": "ProvisioningState/succeeded",
          "level": "Info",
          "displayStatus": "Provisioning succeeded",
          "time": "2019-10-14T21:29:47.477089+00:00"
        }
      ]
    },
    {
      "name": "myDataDisk0",
      "statuses": [
        {
          "code": "ProvisioningState/succeeded",
          "level": "Info",
          "displayStatus": "Provisioning succeeded",
          "time": "2019-10-14T21:29:47.461517+00:00"
        }
      ]
    }
  ],
  "bootDiagnostics": {
    "consoleScreenshotBlobUri": "https://{myStorageAccount}.blob.core.windows.net/bootdiagnostics-myOsDisk/myOsDisk.screenshot.bmp",
    "serialConsoleLogBlobUri": "https://{myStorageAccount}.blob.core.windows.net/bootdiagnostics-myOsDisk/myOsDisk.serialconsole.log"
  },
  "extensions": [
    {
      "name": "IaaSAntiMalware-ext0",
      "type": "Microsoft.Azure.Security.IaaSAntimalware",
      "typeHandlerVersion": "1.5.5.9",
      "statuses": [
        {
          "code": "ProvisioningState/succeeded",
          "level": "Info",
          "displayStatus": "Provisioning succeeded",
          "message": "Microsoft Antimalware enabled"
        }
      ]
    }
  ],
  "hyperVGeneration": "V1",
  "patchStatus": {
    "availablePatchSummary": {
      "status": "Succeeded",
      "assessmentActivityId": "68f8b292-dfc2-4646-9781-33cc88631968",
      "rebootPending": true,
      "criticalAndSecurityPatchCount": 1,
      "otherPatchCount": 2,
      "startTime": "2020-04-24T21:02:04.2556154Z",
      "lastModifiedTime": "2020-04-24T21:02:04.2556154Z",
      "error": null
    },
    "lastPatchInstallationSummary": {
      "status": "Succeeded",
      "installationActivityId": "68f8b292-dfc2-4646-9981-33cc88631968",
      "maintenanceWindowExceeded": false,
      "notSelectedPatchCount": 1,
      "excludedPatchCount": 1,
      "pendingPatchCount": 1,
      "installedPatchCount": 1,
      "failedPatchCount": 1,
      "startTime": "2020-04-24T21:02:04.2556154Z",
      "lastModifiedTime": "2020-04-24T21:02:04.2556154Z",
      "error": null
    },
    "configurationStatuses": [
      {
        "code": "PatchModeConfigurationState/Ready",
        "level": "Info",
        "displayStatus": "Status_PatchModeConfigurationState_Ready",
        "time": "2020-04-24T21:02:04.2556154Z"
      },
      {
        "code": "AssessmentModeConfigurationState/Pending",
        "level": "Info",
        "displayStatus": "Status_AssessmentModeConfigurationState_Pending",
        "time": "2020-04-24T21:02:04.2556154Z"
      }
    ]
  },
  "isVMInStandbyPool": false,
  "statuses": [
    {
      "code": "ProvisioningState/succeeded",
      "level": "Info",
      "displayStatus": "Provisioning succeeded",
      "time": "2019-10-14T21:30:12.8051917+00:00"
    },
    {
      "code": "PowerState/running",
      "level": "Info",
      "displayStatus": "VM running"
    }
  ]
}

Definitions

Name Description
ApiError

Api error.

ApiErrorBase

Api error base.

AvailablePatchSummary

The available patch summary of the latest assessment operation for the virtual machine.

BootDiagnosticsInstanceView

Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. You can easily view the output of your console log. Azure also enables you to see a screenshot of the VM from the hypervisor.

CloudError

An error response from the Compute service.

DiskEncryptionSettings

Specifies the encryption settings for the OS Disk.

Minimum api-version: 2015-06-15

DiskInstanceView

The virtual machine disk information.

HyperVGenerationType

Specifies the HyperVGeneration Type associated with a resource

InnerError

Inner error details.

InstanceViewStatus

Instance view status.

KeyVaultKeyReference

Specifies the location of the key encryption key in Key Vault.

KeyVaultSecretReference

Specifies the location of the disk encryption key, which is a Key Vault Secret.

LastPatchInstallationSummary

The installation summary of the latest installation operation for the virtual machine.

MaintenanceOperationResultCodeTypes

The Last Maintenance Operation Result Code.

MaintenanceRedeployStatus

The Maintenance Operation status on the virtual machine.

PatchOperationStatus

The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings."

StatusLevelTypes

The level code.

SubResource

The relative URL of the Key Vault containing the secret.

VirtualMachineAgentInstanceView

The VM Agent running on the virtual machine.

VirtualMachineExtensionHandlerInstanceView

The virtual machine extension handler instance view.

VirtualMachineExtensionInstanceView

The extensions information.

VirtualMachineHealthStatus

The health status for the VM.

VirtualMachineInstanceView

The instance view of a virtual machine.

VirtualMachinePatchStatus

[Preview Feature] The status of virtual machine patch operations.

ApiError

Api error.

Name Type Description
code

string

The error code.

details

ApiErrorBase[]

The Api error details

innererror

InnerError

The Api inner error

message

string

The error message.

target

string

The target of the particular error.

ApiErrorBase

Api error base.

Name Type Description
code

string

The error code.

message

string

The error message.

target

string

The target of the particular error.

AvailablePatchSummary

The available patch summary of the latest assessment operation for the virtual machine.

Name Type Description
assessmentActivityId

string

The activity ID of the operation that produced this result. It is used to correlate across CRP and extension logs.

criticalAndSecurityPatchCount

integer

The number of critical or security patches that have been detected as available and not yet installed.

error

ApiError

The errors that were encountered during execution of the operation. The details array contains the list of them.

lastModifiedTime

string

The UTC timestamp when the operation began.

otherPatchCount

integer

The number of all available patches excluding critical and security.

rebootPending

boolean

The overall reboot status of the VM. It will be true when partially installed patches require a reboot to complete installation but the reboot has not yet occurred.

startTime

string

The UTC timestamp when the operation began.

status

PatchOperationStatus

The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings."

BootDiagnosticsInstanceView

Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. You can easily view the output of your console log. Azure also enables you to see a screenshot of the VM from the hypervisor.

Name Type Description
consoleScreenshotBlobUri

string

The console screenshot blob URI. Note: This will not be set if boot diagnostics is currently enabled with managed storage.

serialConsoleLogBlobUri

string

The serial console log blob Uri. Note: This will not be set if boot diagnostics is currently enabled with managed storage.

status

InstanceViewStatus

The boot diagnostics status information for the VM. Note: It will be set only if there are errors encountered in enabling boot diagnostics.

CloudError

An error response from the Compute service.

Name Type Description
error

ApiError

Api error.

DiskEncryptionSettings

Specifies the encryption settings for the OS Disk.

Minimum api-version: 2015-06-15

Name Type Description
diskEncryptionKey

KeyVaultSecretReference

Specifies the location of the disk encryption key, which is a Key Vault Secret.

enabled

boolean

Specifies whether disk encryption should be enabled on the virtual machine.

keyEncryptionKey

KeyVaultKeyReference

Specifies the location of the key encryption key in Key Vault.

DiskInstanceView

The virtual machine disk information.

Name Type Description
encryptionSettings

DiskEncryptionSettings[]

Specifies the encryption settings for the OS Disk.

Minimum api-version: 2015-06-15

name

string

The disk name.

statuses

InstanceViewStatus[]

The resource status information.

HyperVGenerationType

Specifies the HyperVGeneration Type associated with a resource

Name Type Description
V1

string

V2

string

InnerError

Inner error details.

Name Type Description
errordetail

string

The internal error message or exception dump.

exceptiontype

string

The exception type.

InstanceViewStatus

Instance view status.

Name Type Description
code

string

The status code.

displayStatus

string

The short localizable label for the status.

level

StatusLevelTypes

The level code.

message

string

The detailed status message, including for alerts and error messages.

time

string

The time of the status.

KeyVaultKeyReference

Specifies the location of the key encryption key in Key Vault.

Name Type Description
keyUrl

string

The URL referencing a key encryption key in Key Vault.

sourceVault

SubResource

The relative URL of the Key Vault containing the key.

KeyVaultSecretReference

Specifies the location of the disk encryption key, which is a Key Vault Secret.

Name Type Description
secretUrl

string

The URL referencing a secret in a Key Vault.

sourceVault

SubResource

The relative URL of the Key Vault containing the secret.

LastPatchInstallationSummary

The installation summary of the latest installation operation for the virtual machine.

Name Type Description
error

ApiError

The errors that were encountered during execution of the operation. The details array contains the list of them.

excludedPatchCount

integer

The number of all available patches but excluded explicitly by a customer-specified exclusion list match.

failedPatchCount

integer

The count of patches that failed installation.

installationActivityId

string

The activity ID of the operation that produced this result. It is used to correlate across CRP and extension logs.

installedPatchCount

integer

The count of patches that successfully installed.

lastModifiedTime

string

The UTC timestamp when the operation began.

maintenanceWindowExceeded

boolean

Describes whether the operation ran out of time before it completed all its intended actions

notSelectedPatchCount

integer

The number of all available patches but not going to be installed because it didn't match a classification or inclusion list entry.

pendingPatchCount

integer

The number of all available patches expected to be installed over the course of the patch installation operation.

startTime

string

The UTC timestamp when the operation began.

status

PatchOperationStatus

The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings."

MaintenanceOperationResultCodeTypes

The Last Maintenance Operation Result Code.

Name Type Description
MaintenanceAborted

string

MaintenanceCompleted

string

None

string

RetryLater

string

MaintenanceRedeployStatus

The Maintenance Operation status on the virtual machine.

Name Type Description
isCustomerInitiatedMaintenanceAllowed

boolean

True, if customer is allowed to perform Maintenance.

lastOperationMessage

string

Message returned for the last Maintenance Operation.

lastOperationResultCode

MaintenanceOperationResultCodeTypes

The Last Maintenance Operation Result Code.

maintenanceWindowEndTime

string

End Time for the Maintenance Window.

maintenanceWindowStartTime

string

Start Time for the Maintenance Window.

preMaintenanceWindowEndTime

string

End Time for the Pre Maintenance Window.

preMaintenanceWindowStartTime

string

Start Time for the Pre Maintenance Window.

PatchOperationStatus

The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings."

Name Type Description
CompletedWithWarnings

string

Failed

string

InProgress

string

Succeeded

string

Unknown

string

StatusLevelTypes

The level code.

Name Type Description
Error

string

Info

string

Warning

string

SubResource

The relative URL of the Key Vault containing the secret.

Name Type Description
id

string

Resource Id

VirtualMachineAgentInstanceView

The VM Agent running on the virtual machine.

Name Type Description
extensionHandlers

VirtualMachineExtensionHandlerInstanceView[]

The virtual machine extension handler instance view.

statuses

InstanceViewStatus[]

The resource status information.

vmAgentVersion

string

The VM Agent full version.

VirtualMachineExtensionHandlerInstanceView

The virtual machine extension handler instance view.

Name Type Description
status

InstanceViewStatus

The extension handler status.

type

string

Specifies the type of the extension; an example is "CustomScriptExtension".

typeHandlerVersion

string

Specifies the version of the script handler.

VirtualMachineExtensionInstanceView

The extensions information.

Name Type Description
name

string

The virtual machine extension name.

statuses

InstanceViewStatus[]

The resource status information.

substatuses

InstanceViewStatus[]

The resource status information.

type

string

Specifies the type of the extension; an example is "CustomScriptExtension".

typeHandlerVersion

string

Specifies the version of the script handler.

VirtualMachineHealthStatus

The health status for the VM.

Name Type Description
status

InstanceViewStatus

The health status information for the VM.

VirtualMachineInstanceView

The instance view of a virtual machine.

Name Type Description
assignedHost

string

Resource id of the dedicated host, on which the virtual machine is allocated through automatic placement, when the virtual machine is associated with a dedicated host group that has automatic placement enabled. Minimum api-version: 2020-06-01.

bootDiagnostics

BootDiagnosticsInstanceView

Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. You can easily view the output of your console log. Azure also enables you to see a screenshot of the VM from the hypervisor.

computerName

string

The computer name assigned to the virtual machine.

disks

DiskInstanceView[]

The virtual machine disk information.

extensions

VirtualMachineExtensionInstanceView[]

The extensions information.

hyperVGeneration

HyperVGenerationType

Specifies the HyperVGeneration Type associated with a resource

isVMInStandbyPool

boolean

[Preview Feature] Specifies whether the VM is currently in or out of the Standby Pool.

maintenanceRedeployStatus

MaintenanceRedeployStatus

The Maintenance Operation status on the virtual machine.

osName

string

The Operating System running on the virtual machine.

osVersion

string

The version of Operating System running on the virtual machine.

patchStatus

VirtualMachinePatchStatus

[Preview Feature] The status of virtual machine patch operations.

platformFaultDomain

integer

Specifies the fault domain of the virtual machine.

platformUpdateDomain

integer

Specifies the update domain of the virtual machine.

rdpThumbPrint

string

The Remote desktop certificate thumbprint.

statuses

InstanceViewStatus[]

The resource status information.

vmAgent

VirtualMachineAgentInstanceView

The VM Agent running on the virtual machine.

vmHealth

VirtualMachineHealthStatus

The health status for the VM.

VirtualMachinePatchStatus

[Preview Feature] The status of virtual machine patch operations.

Name Type Description
availablePatchSummary

AvailablePatchSummary

The available patch summary of the latest assessment operation for the virtual machine.

configurationStatuses

InstanceViewStatus[]

The enablement status of the specified patchMode

lastPatchInstallationSummary

LastPatchInstallationSummary

The installation summary of the latest installation operation for the virtual machine.