VirtualMachineResource Class

Definition

A class representing a VirtualMachine along with the instance operations that can be performed on it. If you have a ResourceIdentifier you can construct a VirtualMachineResource from an instance of ArmClient using the GetResource method. Otherwise you can get one from its parent resource ResourceGroupResource using the GetVirtualMachines method.

public class VirtualMachineResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel<Azure.ResourceManager.Compute.VirtualMachineData>, System.ClientModel.Primitives.IPersistableModel<Azure.ResourceManager.Compute.VirtualMachineData>
type VirtualMachineResource = class
    inherit ArmResource
    interface IJsonModel<VirtualMachineData>
    interface IPersistableModel<VirtualMachineData>
Public Class VirtualMachineResource
Inherits ArmResource
Implements IJsonModel(Of VirtualMachineData), IPersistableModel(Of VirtualMachineData)
Inheritance
VirtualMachineResource
Implements

Constructors

Name Description
VirtualMachineResource()

Initializes a new instance of VirtualMachineResource for mocking.

Fields

Name Description
ResourceType

Gets the resource type for the operations.

Properties

Name Description
Client

Gets the ArmClient this resource client was created from.

(Inherited from ArmResource)
Data

Gets the data representing this Feature.

Diagnostics

Gets the diagnostic options for this resource client.

(Inherited from ArmResource)
Endpoint

Gets the base uri for this resource client.

(Inherited from ArmResource)
HasData

Gets whether or not the current instance has data.

Id

Gets the resource identifier.

(Inherited from ArmResource)
Pipeline

Gets the pipeline for this resource client.

(Inherited from ArmResource)

Methods

Name Description
AddTag(String, String, CancellationToken)

Add a tag to the current resource.

AddTagAsync(String, String, CancellationToken)

Add a tag to the current resource.

AssessPatches(WaitUntil, CancellationToken)

Assess patches on the VM.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches.
  • Operation Id. : VirtualMachines_AssessPatches.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
AssessPatchesAsync(WaitUntil, CancellationToken)

Assess patches on the VM.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches.
  • Operation Id. : VirtualMachines_AssessPatches.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
AttachDetachDataDisks(WaitUntil, AttachDetachDataDisksRequest, CancellationToken)

Attach and detach data disks to/from the virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/attachDetachDataDisks.
  • Operation Id. : VirtualMachines_AttachDetachDataDisks.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
AttachDetachDataDisksAsync(WaitUntil, AttachDetachDataDisksRequest, CancellationToken)

Attach and detach data disks to/from the virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/attachDetachDataDisks.
  • Operation Id. : VirtualMachines_AttachDetachDataDisks.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
CanUseTagResource(CancellationToken)

Checks to see if the TagResource API is deployed in the current environment.

(Inherited from ArmResource)
CanUseTagResourceAsync(CancellationToken)

Checks to see if the TagResource API is deployed in the current environment.

(Inherited from ArmResource)
Capture(WaitUntil, VirtualMachineCaptureContent, CancellationToken)

Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture.
  • Operation Id. : VirtualMachines_Capture.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
CaptureAsync(WaitUntil, VirtualMachineCaptureContent, CancellationToken)

Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture.
  • Operation Id. : VirtualMachines_Capture.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
ConvertToManagedDisks(WaitUntil, CancellationToken)

Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks.
  • Operation Id. : VirtualMachines_ConvertToManagedDisks.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
ConvertToManagedDisksAsync(WaitUntil, CancellationToken)

Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks.
  • Operation Id. : VirtualMachines_ConvertToManagedDisks.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
CreateResourceIdentifier(String, String, String)

Generate the resource identifier for this resource.

Deallocate(WaitUntil, Nullable<Boolean>, Nullable<Boolean>, CancellationToken)

Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine uses.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate.
  • Operation Id. : VirtualMachines_Deallocate.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
DeallocateAsync(WaitUntil, Nullable<Boolean>, Nullable<Boolean>, CancellationToken)

Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine uses.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate.
  • Operation Id. : VirtualMachines_Deallocate.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
Delete(WaitUntil, Nullable<Boolean>, CancellationToken)

The operation to delete a virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}.
  • Operation Id. : VirtualMachines_Delete.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
DeleteAsync(WaitUntil, Nullable<Boolean>, CancellationToken)

The operation to delete a virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}.
  • Operation Id. : VirtualMachines_Delete.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
Generalize(CancellationToken)

Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation. For Windows, please refer to Create a managed image of a generalized VM in Azure. For Linux, please refer to How to create an image of a virtual machine or VHD.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize.
  • Operation Id. : VirtualMachines_Generalize.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
GeneralizeAsync(CancellationToken)

Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation. For Windows, please refer to Create a managed image of a generalized VM in Azure. For Linux, please refer to How to create an image of a virtual machine or VHD.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize.
  • Operation Id. : VirtualMachines_Generalize.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
Get(Nullable<InstanceViewType>, CancellationToken)

Retrieves information about the model view or the instance view of a virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}.
  • Operation Id. : VirtualMachines_Get.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
GetAsync(Nullable<InstanceViewType>, CancellationToken)

Retrieves information about the model view or the instance view of a virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}.
  • Operation Id. : VirtualMachines_Get.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
GetAvailableLocations(CancellationToken)

Lists all available geo-locations.

(Inherited from ArmResource)
GetAvailableLocationsAsync(CancellationToken)

Lists all available geo-locations.

(Inherited from ArmResource)
GetAvailableSizes(CancellationToken)

Lists all available virtual machine sizes to which the specified virtual machine can be resized.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes.
  • Operation Id. : VirtualMachines_ListAvailableSizes.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
GetAvailableSizesAsync(CancellationToken)

Lists all available virtual machine sizes to which the specified virtual machine can be resized.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes.
  • Operation Id. : VirtualMachines_ListAvailableSizes.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
GetManagementLock(String, CancellationToken)

Get a management lock by scope.

  • Request Path: /{scope}/providers/Microsoft.Authorization/locks/{lockName}
  • Operation Id: ManagementLocks_GetByScope
  • Default Api Version: 2020-05-01
  • Resource: ManagementLockResource
(Inherited from ArmResource)
GetManagementLockAsync(String, CancellationToken)

Get a management lock by scope.

  • Request Path: /{scope}/providers/Microsoft.Authorization/locks/{lockName}
  • Operation Id: ManagementLocks_GetByScope
  • Default Api Version: 2020-05-01
  • Resource: ManagementLockResource
(Inherited from ArmResource)
GetManagementLocks()

Gets a collection of ManagementLockResources in the ArmResource.

(Inherited from ArmResource)
GetPolicyAssignment(String, CancellationToken)

This operation retrieves a single policy assignment, given its name and the scope it was created at.

  • Request Path: /{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
  • Operation Id: PolicyAssignments_Get
  • Default Api Version: 2022-06-01
  • Resource: PolicyAssignmentResource
(Inherited from ArmResource)
GetPolicyAssignmentAsync(String, CancellationToken)

This operation retrieves a single policy assignment, given its name and the scope it was created at.

  • Request Path: /{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
  • Operation Id: PolicyAssignments_Get
  • Default Api Version: 2022-06-01
  • Resource: PolicyAssignmentResource
(Inherited from ArmResource)
GetPolicyAssignments()

Gets a collection of PolicyAssignmentResources in the ArmResource.

(Inherited from ArmResource)
GetTagResource()

Gets an object representing a TagResource along with the instance operations that can be performed on it in the ArmResource.

(Inherited from ArmResource)
GetVirtualMachineExtension(String, String, CancellationToken)

The operation to get the extension.

GetVirtualMachineExtensionAsync(String, String, CancellationToken)

The operation to get the extension.

GetVirtualMachineExtensions()

Gets a collection of VirtualMachineExtensions in the VirtualMachineResource.

GetVirtualMachineRunCommand(String, String, CancellationToken)

The operation to get the run command.

GetVirtualMachineRunCommandAsync(String, String, CancellationToken)

The operation to get the run command.

GetVirtualMachineRunCommands()

Gets a collection of VirtualMachineRunCommands in the VirtualMachineResource.

InstallPatches(WaitUntil, VirtualMachineInstallPatchesContent, CancellationToken)

Installs patches on the VM.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches.
  • Operation Id. : VirtualMachines_InstallPatches.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
InstallPatchesAsync(WaitUntil, VirtualMachineInstallPatchesContent, CancellationToken)

Installs patches on the VM.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches.
  • Operation Id. : VirtualMachines_InstallPatches.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
InstanceView(CancellationToken)

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

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView.
  • Operation Id. : VirtualMachines_InstanceView.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
InstanceViewAsync(CancellationToken)

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

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView.
  • Operation Id. : VirtualMachines_InstanceView.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
MigrateToVirtualMachineScaleSet(WaitUntil, MigrateVmToVirtualMachineScaleSetContent, CancellationToken)

Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/migrateToVirtualMachineScaleSet.
  • Operation Id. : VirtualMachines_MigrateToVMScaleSet.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
MigrateToVirtualMachineScaleSetAsync(WaitUntil, MigrateVmToVirtualMachineScaleSetContent, CancellationToken)

Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/migrateToVirtualMachineScaleSet.
  • Operation Id. : VirtualMachines_MigrateToVMScaleSet.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
PerformMaintenance(WaitUntil, CancellationToken)

The operation to perform maintenance on a virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance.
  • Operation Id. : VirtualMachines_PerformMaintenance.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
PerformMaintenanceAsync(WaitUntil, CancellationToken)

The operation to perform maintenance on a virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance.
  • Operation Id. : VirtualMachines_PerformMaintenance.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
PowerOff(WaitUntil, Nullable<Boolean>, CancellationToken)

The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still charged for this virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff.
  • Operation Id. : VirtualMachines_PowerOff.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
PowerOffAsync(WaitUntil, Nullable<Boolean>, CancellationToken)

The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still charged for this virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff.
  • Operation Id. : VirtualMachines_PowerOff.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
PowerOn(WaitUntil, CancellationToken)

The operation to start a virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start.
  • Operation Id. : VirtualMachines_Start.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
PowerOnAsync(WaitUntil, CancellationToken)

The operation to start a virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start.
  • Operation Id. : VirtualMachines_Start.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
Reapply(WaitUntil, CancellationToken)

The operation to reapply a virtual machine's state.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply.
  • Operation Id. : VirtualMachines_Reapply.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
ReapplyAsync(WaitUntil, CancellationToken)

The operation to reapply a virtual machine's state.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply.
  • Operation Id. : VirtualMachines_Reapply.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
Redeploy(WaitUntil, CancellationToken)

Shuts down the virtual machine, moves it to a new node, and powers it back on.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy.
  • Operation Id. : VirtualMachines_Redeploy.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
RedeployAsync(WaitUntil, CancellationToken)

Shuts down the virtual machine, moves it to a new node, and powers it back on.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy.
  • Operation Id. : VirtualMachines_Redeploy.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
Reimage(WaitUntil, VirtualMachineReimageContent, CancellationToken)

Reimages (upgrade the operating system) a virtual machine which don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial state. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should be updated accordingly before performing the reimage.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage.
  • Operation Id. : VirtualMachines_Reimage.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
ReimageAsync(WaitUntil, VirtualMachineReimageContent, CancellationToken)

Reimages (upgrade the operating system) a virtual machine which don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial state. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should be updated accordingly before performing the reimage.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage.
  • Operation Id. : VirtualMachines_Reimage.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
RemoveTag(String, CancellationToken)

Removes a tag by key from the resource.

RemoveTagAsync(String, CancellationToken)

Removes a tag by key from the resource.

Restart(WaitUntil, CancellationToken)

The operation to restart a virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart.
  • Operation Id. : VirtualMachines_Restart.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
RestartAsync(WaitUntil, CancellationToken)

The operation to restart a virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart.
  • Operation Id. : VirtualMachines_Restart.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
RetrieveBootDiagnosticsData(Nullable<Int32>, CancellationToken)

The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData.
  • Operation Id. : VirtualMachines_RetrieveBootDiagnosticsData.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
RetrieveBootDiagnosticsDataAsync(Nullable<Int32>, CancellationToken)

The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData.
  • Operation Id. : VirtualMachines_RetrieveBootDiagnosticsData.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
RunCommand(WaitUntil, RunCommandInput, CancellationToken)

Run command on the VM.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand.
  • Operation Id. : VirtualMachines_RunCommand.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
RunCommandAsync(WaitUntil, RunCommandInput, CancellationToken)

Run command on the VM.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand.
  • Operation Id. : VirtualMachines_RunCommand.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
SetTags(IDictionary<String,String>, CancellationToken)

Replace the tags on the resource with the given set.

SetTagsAsync(IDictionary<String,String>, CancellationToken)

Replace the tags on the resource with the given set.

SimulateEviction(CancellationToken)

The operation to simulate the eviction of spot virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction.
  • Operation Id. : VirtualMachines_SimulateEviction.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
SimulateEvictionAsync(CancellationToken)

The operation to simulate the eviction of spot virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction.
  • Operation Id. : VirtualMachines_SimulateEviction.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
TryGetApiVersion(ResourceType, String)

Gets the api version override if it has been set for the current client options.

(Inherited from ArmResource)
Update(WaitUntil, VirtualMachinePatch, MatchConditions, CancellationToken)

The operation to update a virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}.
  • Operation Id. : VirtualMachines_Update.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.
UpdateAsync(WaitUntil, VirtualMachinePatch, MatchConditions, CancellationToken)

The operation to update a virtual machine.

  • Request Path. : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}.
  • Operation Id. : VirtualMachines_Update.
  • Default Api Version. : 2026-03-01.
  • Resource. : VirtualMachineResource.

Explicit Interface Implementations

Name Description
IJsonModel<VirtualMachineData>.Create(Utf8JsonReader, ModelReaderWriterOptions)

Reads one JSON value (including objects or arrays) from the provided reader and converts it to a model.

IJsonModel<VirtualMachineData>.Write(Utf8JsonWriter, ModelReaderWriterOptions)

Writes the model to the provided Utf8JsonWriter.

IPersistableModel<VirtualMachineData>.Create(BinaryData, ModelReaderWriterOptions)

Converts the provided BinaryData into a model.

IPersistableModel<VirtualMachineData>.GetFormatFromOptions(ModelReaderWriterOptions)

Gets the data interchange format (JSON, Xml, etc) that the model uses when communicating with the service.

IPersistableModel<VirtualMachineData>.Write(ModelReaderWriterOptions)

Writes the model into a BinaryData.

Extension Methods

Name Description
GetAuthorizationRoleDefinition(ArmResource, ResourceIdentifier, CancellationToken)

Gets the role definition identified by roleDefinitionId at this resource scope.

GetAuthorizationRoleDefinitionAsync(ArmResource, ResourceIdentifier, CancellationToken)

Gets the role definition identified by roleDefinitionId at this resource scope.

GetAuthorizationRoleDefinitions(ArmResource)

Gets a collection of AuthorizationRoleDefinitionCollection objects within the specified scope.

GetDenyAssignment(ArmResource, String, CancellationToken)

Get the specified deny assignment.

GetDenyAssignmentAsync(ArmResource, String, CancellationToken)

Get the specified deny assignment.

GetDenyAssignments(ArmResource)

Gets a collection of DenyAssignmentCollection objects within the specified scope.

GetLinkerResource(ArmResource, String, CancellationToken)

Returns Linker resource for a given name.

  • Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}
  • Operation Id: Linker_Get
  • Default Api Version: 2022-05-01
  • Resource: LinkerResource
<item>MockingTo mock this method, please mock GetLinkerResource(String, CancellationToken) instead.</item>
GetLinkerResourceAsync(ArmResource, String, CancellationToken)

Returns Linker resource for a given name.

  • Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}
  • Operation Id: Linker_Get
  • Default Api Version: 2022-05-01
  • Resource: LinkerResource
<item>MockingTo mock this method, please mock GetLinkerResourceAsync(String, CancellationToken) instead.</item>
GetLinkerResources(ArmResource)

Gets a collection of LinkerResources in the ArmResource. <item>MockingTo mock this method, please mock GetLinkerResources() instead.</item>

GetRoleAssignment(ArmResource, String, String, CancellationToken)

Get a role assignment by scope and name.

GetRoleAssignmentAsync(ArmResource, String, String, CancellationToken)

Get a role assignment by scope and name.

GetRoleAssignments(ArmResource)

Gets a collection of RoleAssignmentCollection objects within the specified scope.

GetRoleAssignmentSchedule(ArmResource, String, CancellationToken)

Get the specified role assignment schedule for a resource scope.

GetRoleAssignmentScheduleAsync(ArmResource, String, CancellationToken)

Get the specified role assignment schedule for a resource scope.

GetRoleAssignmentScheduleInstance(ArmResource, String, CancellationToken)

Gets the specified role assignment schedule instance.

GetRoleAssignmentScheduleInstanceAsync(ArmResource, String, CancellationToken)

Gets the specified role assignment schedule instance.

GetRoleAssignmentScheduleInstances(ArmResource)

Gets a collection of RoleAssignmentScheduleInstanceCollection objects within the specified scope.

GetRoleAssignmentScheduleRequest(ArmResource, String, CancellationToken)

Get the specified role assignment schedule request.

GetRoleAssignmentScheduleRequestAsync(ArmResource, String, CancellationToken)

Get the specified role assignment schedule request.

GetRoleAssignmentScheduleRequests(ArmResource)

Gets a collection of RoleAssignmentScheduleRequestCollection objects within the specified scope.

GetRoleAssignmentSchedules(ArmResource)

Gets a collection of RoleAssignmentScheduleCollection objects within the specified scope.

GetRoleEligibilitySchedule(ArmResource, String, CancellationToken)

Get the specified role eligibility schedule for a resource scope.

GetRoleEligibilityScheduleAsync(ArmResource, String, CancellationToken)

Get the specified role eligibility schedule for a resource scope.

GetRoleEligibilityScheduleInstance(ArmResource, String, CancellationToken)

Gets the specified role eligibility schedule instance.

GetRoleEligibilityScheduleInstanceAsync(ArmResource, String, CancellationToken)

Gets the specified role eligibility schedule instance.

GetRoleEligibilityScheduleInstances(ArmResource)

Gets a collection of RoleEligibilityScheduleInstanceCollection objects within the specified scope.

GetRoleEligibilityScheduleRequest(ArmResource, String, CancellationToken)

Get the specified role eligibility schedule request.

GetRoleEligibilityScheduleRequestAsync(ArmResource, String, CancellationToken)

Get the specified role eligibility schedule request.

GetRoleEligibilityScheduleRequests(ArmResource)

Gets a collection of RoleEligibilityScheduleRequestCollection objects within the specified scope.

GetRoleEligibilitySchedules(ArmResource)

Gets a collection of RoleEligibilityScheduleCollection objects within the specified scope.

GetRoleManagementPolicies(ArmResource)

Gets a collection of RoleManagementPolicyCollection objects within the specified scope.

GetRoleManagementPolicy(ArmResource, String, CancellationToken)

Get the specified role management policy for a resource scope.

GetRoleManagementPolicyAssignment(ArmResource, String, CancellationToken)

Get the specified role management policy assignment for a resource scope.

GetRoleManagementPolicyAssignmentAsync(ArmResource, String, CancellationToken)

Get the specified role management policy assignment for a resource scope.

GetRoleManagementPolicyAssignments(ArmResource)

Gets a collection of RoleManagementPolicyAssignmentCollection objects within the specified scope.

GetRoleManagementPolicyAsync(ArmResource, String, CancellationToken)

Get the specified role management policy for a resource scope.

GetSystemAssignedIdentity(ArmResource)

Gets an object representing a SystemAssignedIdentityResource along with the instance operations that can be performed on it in the ArmResource scope.

Applies to