Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,16 @@ interface VirtualMachines {
OptionalRequestBody = true
>;

/**
* Restores all operating system and data disks of a deallocated virtual machine from a virtual machine restore point. The restore point must contain restore point data for every disk currently attached to the virtual machine.
*/
@added(Versions.v2026_09_01)
restore is ComputeResourceActionNoResponseContentAsync<
VirtualMachine,
VirtualMachineRestoreParameters,
Error = CloudError
>;

/**
* The operation to restart a virtual machine.
*/
Expand Down Expand Up @@ -463,6 +473,10 @@ interface VirtualMachines {
VirtualMachines.reimage::parameters.body,
"Parameters supplied to the Reimage Virtual Machine operation."
);
@@doc(
VirtualMachines.restore::parameters.body,
"Parameters supplied to restore the virtual machine disks from a restore point."
);
@@doc(
VirtualMachines.runCommand::parameters.body,
"Parameters supplied to the Run command operation."
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "@typespec/versioning";
import "./models.tsp";
import "./VirtualMachine.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using Common;
using TypeSpec.Versioning;

namespace Compute;

/**
* Describes the protection configuration of a virtual machine.
*/
@added(Versions.v2026_09_01)
@singleton("default")
@parentResource(VirtualMachine)
model VirtualMachineProtection
is Azure.ResourceManager.ProxyResource<VirtualMachineProtectionProperties> {
...ResourceNameParameter<
Resource = VirtualMachineProtection,
KeyName = "vmProtectionName",
SegmentName = "vmProtection",
NamePattern = ""
>;
}

/**
* Operations for managing the protection configuration of a virtual machine.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation" "The singleton protection resource is always addressable. Protection is disabled by updating protectionType to None rather than deleting the resource."

Check warning on line 37 in specification/compute/resource-manager/Microsoft.Compute/Compute/Compute/VirtualMachineProtection.tsp

View workflow job for this annotation

GitHub Actions / TypeSpec Suppressions - Analyze Code

⚠️ New Suppression

Authors should avoid adding new suppressions and prefer fixing the underlying issue; reviewers should approve only when there is a clear, compelling justification and no reasonable alternative.
@added(Versions.v2026_09_01)
@armResourceOperations(#{ omitTags: true })
@tag("VirtualMachineProtections")
interface VirtualMachineProtections {
/**
* Gets the protection configuration of a virtual machine.
*/
@added(Versions.v2026_09_01)
get is ComputeResourceRead<VirtualMachineProtection>;

/**
* Creates or updates the protection configuration of a virtual machine.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "CRP returns 200 for synchronous updates and 202 for asynchronous updates to the always-addressable protection singleton."

Check warning on line 51 in specification/compute/resource-manager/Microsoft.Compute/Compute/Compute/VirtualMachineProtection.tsp

View workflow job for this annotation

GitHub Actions / TypeSpec Suppressions - Analyze Code

⚠️ New Suppression

Authors should avoid adding new suppressions and prefer fixing the underlying issue; reviewers should approve only when there is a clear, compelling justification and no reasonable alternative.
@added(Versions.v2026_09_01)
@Azure.Core.useFinalStateVia("original-uri")
createOrUpdate is ComputeResourceCreateOrReplaceAsync<
VirtualMachineProtection,
Response =
| ArmResourceUpdatedResponse<VirtualMachineProtection>
| (ArmAcceptedLroResponse<LroHeaders = ArmCombinedLroHeaders<FinalResult = VirtualMachineProtection>> & {
@bodyRoot _: VirtualMachineProtection;
})
>;
}

@@doc(VirtualMachineProtection.name, "The singleton resource name.");
@@doc(
VirtualMachineProtection.properties,
"The properties of the virtual machine protection configuration."
);
@@doc(
VirtualMachineProtections.createOrUpdate::parameters.resource,
"Parameters supplied to create or update the virtual machine protection configuration."
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"title": "Enable Basic VM Protection",
"operationId": "VirtualMachineProtections_CreateOrUpdate",
"parameters": {
"subscriptionId": "{subscription-id}",
"resourceGroupName": "myResourceGroup",
"vmName": "myVM",
"api-version": "2026-09-01",
"resource": {
"properties": {
"protectionType": "Basic"
}
}
},
"responses": {
"202": {
"headers": {
"Azure-AsyncOperation": "https://management.azure.com/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus/operations/{operation-id}?api-version=2026-09-01",
"Location": "https://management.azure.com/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus/operations/{operation-id}?api-version=2026-09-01&monitor=true"
},
"body": {
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/vmProtection/default",
"properties": {
"protectionType": "Basic"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"title": "Disable VM Protection",
"operationId": "VirtualMachineProtections_CreateOrUpdate",
"parameters": {
"subscriptionId": "{subscription-id}",
"resourceGroupName": "myResourceGroup",
"vmName": "myVM",
"api-version": "2026-09-01",
"resource": {
"properties": {
"protectionType": "None"
}
}
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/vmProtection/default",
"properties": {
"protectionType": "None"
}
}
},
"202": {
"headers": {
"Azure-AsyncOperation": "https://management.azure.com/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus/operations/{operation-id}?api-version=2026-09-01",
"Location": "https://management.azure.com/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus/operations/{operation-id}?api-version=2026-09-01&monitor=true"
},
"body": {
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/vmProtection/default",
"properties": {
"protectionType": "None"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"title": "Get Azure Backup VM Protection",
"operationId": "VirtualMachineProtections_Get",
"parameters": {
"subscriptionId": "{subscription-id}",
"resourceGroupName": "myResourceGroup",
"vmName": "myVM",
"api-version": "2026-09-01"
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/vmProtection/default",
"name": "default",
"type": "Microsoft.Compute/virtualMachines/vmProtection",
"properties": {
"protectionType": "AzureBackup",
"provisioningState": "Succeeded",
"restorePointCollectionId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/AzureManagedRPC-myVM-0f47b100-583c-48e3-a4c0-aefc2c9bbcc1",
"backupResourceId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.RecoveryServices/vaults/myRecoveryServicesVault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;myResourceGroup;myVM/protectedItems/VM;iaasvmcontainerv2;myResourceGroup;myVM"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"title": "Get Basic VM Protection",
"operationId": "VirtualMachineProtections_Get",
"parameters": {
"subscriptionId": "{subscription-id}",
"resourceGroupName": "myResourceGroup",
"vmName": "myVM",
"api-version": "2026-09-01"
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/vmProtection/default",
"name": "default",
"type": "Microsoft.Compute/virtualMachines/vmProtection",
"properties": {
"protectionType": "Basic",
"provisioningState": "Succeeded",
"restorePointCollectionId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/AzureManagedRPC-myVM-0f47b100-583c-48e3-a4c0-aefc2c9bbcc1"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"title": "Get VM Protection when protection is not enabled",
"operationId": "VirtualMachineProtections_Get",
"parameters": {
"subscriptionId": "{subscription-id}",
"resourceGroupName": "myResourceGroup",
"vmName": "myVM",
"api-version": "2026-09-01"
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/vmProtection/default",
"name": "default",
"type": "Microsoft.Compute/virtualMachines/vmProtection",
"properties": {
"protectionType": "None",
"provisioningState": "Succeeded"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"title": "Restore all disks of a virtual machine",
"operationId": "VirtualMachines_Restore",
"parameters": {
"subscriptionId": "{subscription-id}",
"resourceGroupName": "myResourceGroup",
"vmName": "myVM",
"api-version": "2026-09-01",
"body": {
"restorePointId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/AzureManagedRPC-myVM-0f47b100-583c-48e3-a4c0-aefc2c9bbcc1/restorePoints/daily-restore-point"
}
},
"responses": {
"202": {
"headers": {
"Location": "https://management.azure.com/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/westus/operations/{operation-id}?api-version=2026-09-01&monitor=true"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import "./VirtualMachineScaleSetLifecycleHookEvent.tsp";
import "./VirtualMachineScaleSetVM.tsp";
import "./VirtualMachineScaleSetVMExtension.tsp";
import "./VirtualMachine.tsp";
import "./VirtualMachineProtection.tsp";
import "./VirtualMachineExtension.tsp";
import "./VirtualMachineExtensionImage.tsp";
import "./AvailabilitySet.tsp";
Expand Down
Loading
Loading