Creates or updates a snapshot.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}?api-version=2024-03-02
URI Parameters
Name |
In |
Required |
Type |
Description |
resourceGroupName
|
path |
True
|
string
|
The name of the resource group.
|
snapshotName
|
path |
True
|
string
|
The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.
|
subscriptionId
|
path |
True
|
string
|
Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
|
api-version
|
query |
True
|
string
|
Client Api Version.
|
Request Body
Name |
Required |
Type |
Description |
location
|
True
|
string
|
Resource location
|
properties.creationData
|
True
|
CreationData
|
Disk source information. CreationData information cannot be changed after the disk has been created.
|
extendedLocation
|
|
ExtendedLocation
|
The extended location where the snapshot will be created. Extended location cannot be changed.
|
properties.completionPercent
|
|
number
|
Percentage complete for the background copy when a resource is created via the CopyStart operation.
|
properties.copyCompletionError
|
|
CopyCompletionError
|
Indicates the error details if the background copy of a resource created via the CopyStart operation fails.
|
properties.dataAccessAuthMode
|
|
DataAccessAuthMode
|
Additional authentication requirements when exporting or uploading to a disk or snapshot.
|
properties.diskAccessId
|
|
string
|
ARM id of the DiskAccess resource for using private endpoints on disks.
|
properties.diskSizeGB
|
|
integer
|
If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.
|
properties.encryption
|
|
Encryption
|
Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys.
|
properties.encryptionSettingsCollection
|
|
EncryptionSettingsCollection
|
Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot.
|
properties.hyperVGeneration
|
|
HyperVGeneration
|
The hypervisor generation of the Virtual Machine. Applicable to OS disks only.
|
properties.incremental
|
|
boolean
|
Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed.
|
properties.networkAccessPolicy
|
|
NetworkAccessPolicy
|
Policy for accessing the disk via network.
|
properties.osType
|
|
OperatingSystemTypes
|
The Operating System type.
|
properties.publicNetworkAccess
|
|
PublicNetworkAccess
|
Policy for controlling export on the disk.
|
properties.purchasePlan
|
|
PurchasePlan
|
Purchase plan information for the image from which the source disk for the snapshot was originally created.
|
properties.securityProfile
|
|
DiskSecurityProfile
|
Contains the security related information for the resource.
|
properties.supportedCapabilities
|
|
SupportedCapabilities
|
List of supported capabilities for the image from which the source disk from the snapshot was originally created.
|
properties.supportsHibernation
|
|
boolean
|
Indicates the OS on a snapshot supports hibernation.
|
sku
|
|
SnapshotSku
|
The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot
|
tags
|
|
object
|
Resource tags
|
Responses
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
Create a snapshot by importing an unmanaged blob from a different subscription.
Sample request
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1?api-version=2024-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "Import",
"storageAccountId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
}
}
}
import com.azure.resourcemanager.compute.fluent.models.SnapshotInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
/**
* Samples for Snapshots CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/
* Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.json
*/
/**
* Sample code: Create a snapshot by importing an unmanaged blob from a different subscription.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getSnapshots()
.createOrUpdate("myResourceGroup", "mySnapshot1", new SnapshotInner().withLocation("West US")
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.IMPORT).withStorageAccountId(
"subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount")
.withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python snapshot_create_by_importing_an_unmanaged_blob_from_adifferent_subscription.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.snapshots.begin_create_or_update(
resource_group_name="myResourceGroup",
snapshot_name="mySnapshot1",
snapshot={
"location": "West US",
"properties": {
"creationData": {
"createOption": "Import",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
"storageAccountId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
}
},
},
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c7b98b36e4023331545051284d8500adf98f02fe/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.json
func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSnapshotsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot1", armcompute.Snapshot{
Location: to.Ptr("West US"),
Properties: &armcompute.SnapshotProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionImport),
SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
StorageAccountID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Snapshot = armcompute.Snapshot{
// Name: to.Ptr("mySnapshot1"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.SnapshotProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionImport),
// SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
// StorageAccountID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
// },
// ProvisioningState: to.Ptr("Succeeded"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a snapshot.
*
* @summary Creates or updates a snapshot.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.json
*/
async function createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const snapshotName = "mySnapshot1";
const snapshot = {
creationData: {
createOption: "Import",
sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
storageAccountId:
"subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
},
location: "West US",
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.snapshots.beginCreateOrUpdateAndWait(
resourceGroupName,
snapshotName,
snapshot,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.json
// this example is just showing the usage of "Snapshots_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SnapshotResource
SnapshotCollection collection = resourceGroupResource.GetSnapshots();
// invoke the operation
string snapshotName = "mySnapshot1";
SnapshotData data = new SnapshotData(new AzureLocation("West US"))
{
CreationData = new DiskCreationData(DiskCreateOption.Import)
{
StorageAccountId = new ResourceIdentifier("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
SourceUri = new Uri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
},
};
ArmOperation<SnapshotResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, snapshotName, data);
SnapshotResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SnapshotData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot",
"properties": {
"creationData": {
"createOption": "Import",
"storageAccountId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "mySnapshot1"
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot",
"properties": {
"creationData": {
"createOption": "Import",
"storageAccountId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "mySnapshot1"
}
Create a snapshot by importing an unmanaged blob from the same subscription.
Sample request
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1?api-version=2024-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "Import",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
}
}
}
import com.azure.resourcemanager.compute.fluent.models.SnapshotInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
/**
* Samples for Snapshots CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/
* Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.json
*/
/**
* Sample code: Create a snapshot by importing an unmanaged blob from the same subscription.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getSnapshots().createOrUpdate("myResourceGroup",
"mySnapshot1",
new SnapshotInner().withLocation("West US")
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.IMPORT)
.withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python snapshot_create_by_importing_an_unmanaged_blob_from_the_same_subscription.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.snapshots.begin_create_or_update(
resource_group_name="myResourceGroup",
snapshot_name="mySnapshot1",
snapshot={
"location": "West US",
"properties": {
"creationData": {
"createOption": "Import",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
}
},
},
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c7b98b36e4023331545051284d8500adf98f02fe/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.json
func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSnapshotsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot1", armcompute.Snapshot{
Location: to.Ptr("West US"),
Properties: &armcompute.SnapshotProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionImport),
SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Snapshot = armcompute.Snapshot{
// Name: to.Ptr("mySnapshot1"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.SnapshotProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionImport),
// SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
// },
// ProvisioningState: to.Ptr("Succeeded"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a snapshot.
*
* @summary Creates or updates a snapshot.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.json
*/
async function createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const snapshotName = "mySnapshot1";
const snapshot = {
creationData: {
createOption: "Import",
sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
},
location: "West US",
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.snapshots.beginCreateOrUpdateAndWait(
resourceGroupName,
snapshotName,
snapshot,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.json
// this example is just showing the usage of "Snapshots_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SnapshotResource
SnapshotCollection collection = resourceGroupResource.GetSnapshots();
// invoke the operation
string snapshotName = "mySnapshot1";
SnapshotData data = new SnapshotData(new AzureLocation("West US"))
{
CreationData = new DiskCreationData(DiskCreateOption.Import)
{
SourceUri = new Uri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
},
};
ArmOperation<SnapshotResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, snapshotName, data);
SnapshotResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SnapshotData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot",
"properties": {
"creationData": {
"createOption": "Import",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "mySnapshot1"
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot",
"properties": {
"creationData": {
"createOption": "Import",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "mySnapshot1"
}
Create a snapshot from an elastic san volume snapshot.
Sample request
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot?api-version=2024-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "CopyFromSanSnapshot",
"elasticSanResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"
}
}
}
import com.azure.resourcemanager.compute.fluent.models.SnapshotInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
/**
* Samples for Snapshots CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/
* Snapshot_Create_FromAnElasticSanVolumeSnapshot.json
*/
/**
* Sample code: Create a snapshot from an elastic san volume snapshot.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
createASnapshotFromAnElasticSanVolumeSnapshot(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getSnapshots().createOrUpdate("myResourceGroup", "mySnapshot",
new SnapshotInner().withLocation("West US").withCreationData(
new CreationData().withCreateOption(DiskCreateOption.COPY_FROM_SAN_SNAPSHOT).withElasticSanResourceId(
"subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot")),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python snapshot_create_from_an_elastic_san_volume_snapshot.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.snapshots.begin_create_or_update(
resource_group_name="myResourceGroup",
snapshot_name="mySnapshot",
snapshot={
"location": "West US",
"properties": {
"creationData": {
"createOption": "CopyFromSanSnapshot",
"elasticSanResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot",
}
},
},
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_FromAnElasticSanVolumeSnapshot.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c7b98b36e4023331545051284d8500adf98f02fe/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_FromAnElasticSanVolumeSnapshot.json
func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotFromAnElasticSanVolumeSnapshot() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSnapshotsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot", armcompute.Snapshot{
Location: to.Ptr("West US"),
Properties: &armcompute.SnapshotProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyFromSanSnapshot),
ElasticSanResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Snapshot = armcompute.Snapshot{
// Name: to.Ptr("mySnapshot"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.SnapshotProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyFromSanSnapshot),
// ElasticSanResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"),
// },
// ProvisioningState: to.Ptr("Succeeded"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a snapshot.
*
* @summary Creates or updates a snapshot.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_FromAnElasticSanVolumeSnapshot.json
*/
async function createASnapshotFromAnElasticSanVolumeSnapshot() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const snapshotName = "mySnapshot";
const snapshot = {
creationData: {
createOption: "CopyFromSanSnapshot",
elasticSanResourceId:
"subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot",
},
location: "West US",
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.snapshots.beginCreateOrUpdateAndWait(
resourceGroupName,
snapshotName,
snapshot,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_FromAnElasticSanVolumeSnapshot.json
// this example is just showing the usage of "Snapshots_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SnapshotResource
SnapshotCollection collection = resourceGroupResource.GetSnapshots();
// invoke the operation
string snapshotName = "mySnapshot";
SnapshotData data = new SnapshotData(new AzureLocation("West US"))
{
CreationData = new DiskCreationData(DiskCreateOption.CopyFromSanSnapshot)
{
ElasticSanResourceId = new ResourceIdentifier("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"),
},
};
ArmOperation<SnapshotResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, snapshotName, data);
SnapshotResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SnapshotData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot",
"name": "mySnapshot",
"location": "West US",
"properties": {
"provisioningState": "Updating",
"creationData": {
"createOption": "CopyFromSanSnapshot",
"elasticSanResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"
}
}
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot",
"name": "mySnapshot",
"location": "West US",
"properties": {
"provisioningState": "Updating",
"creationData": {
"createOption": "CopyFromSanSnapshot",
"elasticSanResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"
}
}
}
Create a snapshot from an existing snapshot in the same or a different subscription in a different region with quicker copy speed.
Sample request
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2?api-version=2024-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "CopyStart",
"sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1",
"provisionedBandwidthCopySpeed": "Enhanced"
}
}
}
import com.azure.resourcemanager.compute.fluent.models.SnapshotInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
import com.azure.resourcemanager.compute.models.ProvisionedBandwidthCopyOption;
/**
* Samples for Snapshots CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/
* Snapshot_Create_EnhancedProvisionedBandwidthCopySpeed.json
*/
/**
* Sample code: Create a snapshot from an existing snapshot in the same or a different subscription in a different
* region with quicker copy speed.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegionWithQuickerCopySpeed(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getSnapshots()
.createOrUpdate("myResourceGroup", "mySnapshot2", new SnapshotInner().withLocation("West US")
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.COPY_START).withSourceResourceId(
"subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1")
.withProvisionedBandwidthCopySpeed(ProvisionedBandwidthCopyOption.ENHANCED)),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python snapshot_create_enhanced_provisioned_bandwidth_copy_speed.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.snapshots.begin_create_or_update(
resource_group_name="myResourceGroup",
snapshot_name="mySnapshot2",
snapshot={
"location": "West US",
"properties": {
"creationData": {
"createOption": "CopyStart",
"provisionedBandwidthCopySpeed": "Enhanced",
"sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1",
}
},
},
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_EnhancedProvisionedBandwidthCopySpeed.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c7b98b36e4023331545051284d8500adf98f02fe/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_EnhancedProvisionedBandwidthCopySpeed.json
func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegionWithQuickerCopySpeed() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSnapshotsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot2", armcompute.Snapshot{
Location: to.Ptr("West US"),
Properties: &armcompute.SnapshotProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyStart),
ProvisionedBandwidthCopySpeed: to.Ptr(armcompute.ProvisionedBandwidthCopyOptionEnhanced),
SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Snapshot = armcompute.Snapshot{
// Name: to.Ptr("mySnapshot2"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.SnapshotProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyStart),
// ProvisionedBandwidthCopySpeed: to.Ptr(armcompute.ProvisionedBandwidthCopyOptionEnhanced),
// SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
// },
// ProvisioningState: to.Ptr("Succeeded"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a snapshot.
*
* @summary Creates or updates a snapshot.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_EnhancedProvisionedBandwidthCopySpeed.json
*/
async function createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegionWithQuickerCopySpeed() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const snapshotName = "mySnapshot2";
const snapshot = {
creationData: {
createOption: "CopyStart",
provisionedBandwidthCopySpeed: "Enhanced",
sourceResourceId:
"subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1",
},
location: "West US",
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.snapshots.beginCreateOrUpdateAndWait(
resourceGroupName,
snapshotName,
snapshot,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_EnhancedProvisionedBandwidthCopySpeed.json
// this example is just showing the usage of "Snapshots_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SnapshotResource
SnapshotCollection collection = resourceGroupResource.GetSnapshots();
// invoke the operation
string snapshotName = "mySnapshot2";
SnapshotData data = new SnapshotData(new AzureLocation("West US"))
{
CreationData = new DiskCreationData(DiskCreateOption.CopyStart)
{
SourceResourceId = new ResourceIdentifier("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
ProvisionedBandwidthCopySpeed = ProvisionedBandwidthCopyOption.Enhanced,
},
};
ArmOperation<SnapshotResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, snapshotName, data);
SnapshotResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SnapshotData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2",
"name": "mySnapshot2",
"location": "West US",
"properties": {
"provisioningState": "Updating",
"creationData": {
"createOption": "CopyStart",
"sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1",
"provisionedBandwidthCopySpeed": "Enhanced"
}
}
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2",
"name": "mySnapshot2",
"location": "West US",
"properties": {
"provisioningState": "Updating",
"creationData": {
"createOption": "CopyStart",
"sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1",
"provisionedBandwidthCopySpeed": "Enhanced"
}
}
}
Create a snapshot from an existing snapshot in the same or a different subscription in a different region.
Sample request
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2?api-version=2024-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "CopyStart",
"sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"
}
}
}
import com.azure.resourcemanager.compute.fluent.models.SnapshotInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
/**
* Samples for Snapshots CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/
* Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.json
*/
/**
* Sample code: Create a snapshot from an existing snapshot in the same or a different subscription in a different
* region.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegion(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getSnapshots()
.createOrUpdate("myResourceGroup", "mySnapshot2", new SnapshotInner().withLocation("West US")
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.COPY_START).withSourceResourceId(
"subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1")),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python snapshot_create_from_an_existing_snapshot_in_different_region.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.snapshots.begin_create_or_update(
resource_group_name="myResourceGroup",
snapshot_name="mySnapshot2",
snapshot={
"location": "West US",
"properties": {
"creationData": {
"createOption": "CopyStart",
"sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1",
}
},
},
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c7b98b36e4023331545051284d8500adf98f02fe/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.json
func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegion() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSnapshotsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot2", armcompute.Snapshot{
Location: to.Ptr("West US"),
Properties: &armcompute.SnapshotProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyStart),
SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Snapshot = armcompute.Snapshot{
// Name: to.Ptr("mySnapshot2"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.SnapshotProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyStart),
// SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
// },
// ProvisioningState: to.Ptr("Succeeded"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a snapshot.
*
* @summary Creates or updates a snapshot.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.json
*/
async function createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegion() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const snapshotName = "mySnapshot2";
const snapshot = {
creationData: {
createOption: "CopyStart",
sourceResourceId:
"subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1",
},
location: "West US",
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.snapshots.beginCreateOrUpdateAndWait(
resourceGroupName,
snapshotName,
snapshot,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.json
// this example is just showing the usage of "Snapshots_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SnapshotResource
SnapshotCollection collection = resourceGroupResource.GetSnapshots();
// invoke the operation
string snapshotName = "mySnapshot2";
SnapshotData data = new SnapshotData(new AzureLocation("West US"))
{
CreationData = new DiskCreationData(DiskCreateOption.CopyStart)
{
SourceResourceId = new ResourceIdentifier("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
},
};
ArmOperation<SnapshotResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, snapshotName, data);
SnapshotResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SnapshotData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2",
"name": "mySnapshot2",
"location": "West US",
"properties": {
"provisioningState": "Updating",
"creationData": {
"createOption": "CopyStart",
"sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"
}
}
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2",
"name": "mySnapshot2",
"location": "West US",
"properties": {
"provisioningState": "Updating",
"creationData": {
"createOption": "CopyStart",
"sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"
}
}
}
Create a snapshot from an existing snapshot in the same or a different subscription.
Sample request
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2?api-version=2024-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "Copy",
"sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"
}
}
}
import com.azure.resourcemanager.compute.fluent.models.SnapshotInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
/**
* Samples for Snapshots CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/
* Snapshot_Create_FromAnExistingSnapshot.json
*/
/**
* Sample code: Create a snapshot from an existing snapshot in the same or a different subscription.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getSnapshots()
.createOrUpdate("myResourceGroup", "mySnapshot2", new SnapshotInner().withLocation("West US")
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.COPY).withSourceResourceId(
"subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1")),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python snapshot_create_from_an_existing_snapshot.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.snapshots.begin_create_or_update(
resource_group_name="myResourceGroup",
snapshot_name="mySnapshot2",
snapshot={
"location": "West US",
"properties": {
"creationData": {
"createOption": "Copy",
"sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1",
}
},
},
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshot.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c7b98b36e4023331545051284d8500adf98f02fe/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshot.json
func ExampleSnapshotsClient_BeginCreateOrUpdate_createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSnapshotsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "mySnapshot2", armcompute.Snapshot{
Location: to.Ptr("West US"),
Properties: &armcompute.SnapshotProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy),
SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Snapshot = armcompute.Snapshot{
// Name: to.Ptr("mySnapshot2"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.SnapshotProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy),
// SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
// },
// ProvisioningState: to.Ptr("Succeeded"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a snapshot.
*
* @summary Creates or updates a snapshot.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshot.json
*/
async function createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const snapshotName = "mySnapshot2";
const snapshot = {
creationData: {
createOption: "Copy",
sourceResourceId:
"subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1",
},
location: "West US",
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.snapshots.beginCreateOrUpdateAndWait(
resourceGroupName,
snapshotName,
snapshot,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshot.json
// this example is just showing the usage of "Snapshots_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SnapshotResource
SnapshotCollection collection = resourceGroupResource.GetSnapshots();
// invoke the operation
string snapshotName = "mySnapshot2";
SnapshotData data = new SnapshotData(new AzureLocation("West US"))
{
CreationData = new DiskCreationData(DiskCreateOption.Copy)
{
SourceResourceId = new ResourceIdentifier("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
},
};
ArmOperation<SnapshotResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, snapshotName, data);
SnapshotResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SnapshotData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2",
"name": "mySnapshot2",
"location": "West US",
"properties": {
"provisioningState": "Updating",
"creationData": {
"createOption": "Copy",
"sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"
}
}
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2",
"name": "mySnapshot2",
"location": "West US",
"properties": {
"provisioningState": "Updating",
"creationData": {
"createOption": "Copy",
"sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"
}
}
}
Definitions
Architecture
CPU architecture supported by an OS disk.
Name |
Type |
Description |
Arm64
|
string
|
|
x64
|
string
|
|
CopyCompletionError
Indicates the error details if the background copy of a resource created via the CopyStart operation fails.
Name |
Type |
Description |
errorCode
|
CopyCompletionErrorReason
|
Indicates the error code if the background copy of a resource created via the CopyStart operation fails.
|
errorMessage
|
string
|
Indicates the error message if the background copy of a resource created via the CopyStart operation fails.
|
CopyCompletionErrorReason
Indicates the error code if the background copy of a resource created via the CopyStart operation fails.
Name |
Type |
Description |
CopySourceNotFound
|
string
|
Indicates that the source snapshot was deleted while the background copy of the resource created via CopyStart operation was in progress.
|
CreationData
Data used when creating a disk.
Name |
Type |
Description |
createOption
|
DiskCreateOption
|
This enumerates the possible sources of a disk's creation.
|
elasticSanResourceId
|
string
|
Required if createOption is CopyFromSanSnapshot. This is the ARM id of the source elastic san volume snapshot.
|
galleryImageReference
|
ImageDiskReference
|
Required if creating from a Gallery Image. The id/sharedGalleryImageId/communityGalleryImageId of the ImageDiskReference will be the ARM id of the shared galley image version from which to create a disk.
|
imageReference
|
ImageDiskReference
|
Disk source information for PIR or user images.
|
logicalSectorSize
|
integer
|
Logical sector size in bytes for Ultra disks. Supported values are 512 ad 4096. 4096 is the default.
|
performancePlus
|
boolean
|
Set this flag to true to get a boost on the performance target of the disk deployed, see here on the respective performance target. This flag can only be set on disk creation time and cannot be disabled after enabled.
|
provisionedBandwidthCopySpeed
|
ProvisionedBandwidthCopyOption
|
If this field is set on a snapshot and createOption is CopyStart, the snapshot will be copied at a quicker speed.
|
securityDataUri
|
string
|
If createOption is ImportSecure, this is the URI of a blob to be imported into VM guest state.
|
sourceResourceId
|
string
|
If createOption is Copy, this is the ARM id of the source snapshot or disk.
|
sourceUniqueId
|
string
|
If this field is set, this is the unique id identifying the source of this resource.
|
sourceUri
|
string
|
If createOption is Import, this is the URI of a blob to be imported into a managed disk.
|
storageAccountId
|
string
|
Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk.
|
uploadSizeBytes
|
integer
|
If createOption is Upload, this is the size of the contents of the upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer).
|
DataAccessAuthMode
Additional authentication requirements when exporting or uploading to a disk or snapshot.
Name |
Type |
Description |
AzureActiveDirectory
|
string
|
When export/upload URL is used, the system checks if the user has an identity in Azure Active Directory and has necessary permissions to export/upload the data. Please refer to aka.ms/DisksAzureADAuth.
|
None
|
string
|
No additional authentication would be performed when accessing export/upload URL.
|
DiskCreateOption
This enumerates the possible sources of a disk's creation.
Name |
Type |
Description |
Attach
|
string
|
Disk will be attached to a VM.
|
Copy
|
string
|
Create a new disk or snapshot by copying from a disk or snapshot specified by the given sourceResourceId.
|
CopyFromSanSnapshot
|
string
|
Create a new disk by exporting from elastic san volume snapshot
|
CopyStart
|
string
|
Create a new disk by using a deep copy process, where the resource creation is considered complete only after all data has been copied from the source.
|
Empty
|
string
|
Create an empty data disk of a size given by diskSizeGB.
|
FromImage
|
string
|
Create a new disk from a platform image specified by the given imageReference or galleryImageReference.
|
Import
|
string
|
Create a disk by importing from a blob specified by a sourceUri in a storage account specified by storageAccountId.
|
ImportSecure
|
string
|
Similar to Import create option. Create a new Trusted Launch VM or Confidential VM supported disk by importing additional blob for VM guest state specified by securityDataUri in storage account specified by storageAccountId
|
Restore
|
string
|
Create a new disk by copying from a backup recovery point.
|
Upload
|
string
|
Create a new disk by obtaining a write token and using it to directly upload the contents of the disk.
|
UploadPreparedSecure
|
string
|
Similar to Upload create option. Create a new Trusted Launch VM or Confidential VM supported disk and upload using write token in both disk and VM guest state
|
DiskSecurityProfile
Contains the security related information for the resource.
Name |
Type |
Description |
secureVMDiskEncryptionSetId
|
string
|
ResourceId of the disk encryption set associated to Confidential VM supported disk encrypted with customer managed key
|
securityType
|
DiskSecurityTypes
|
Specifies the SecurityType of the VM. Applicable for OS disks only.
|
DiskSecurityTypes
Specifies the SecurityType of the VM. Applicable for OS disks only.
Name |
Type |
Description |
ConfidentialVM_DiskEncryptedWithCustomerKey
|
string
|
Indicates Confidential VM disk with both OS disk and VM guest state encrypted with a customer managed key
|
ConfidentialVM_DiskEncryptedWithPlatformKey
|
string
|
Indicates Confidential VM disk with both OS disk and VM guest state encrypted with a platform managed key
|
ConfidentialVM_NonPersistedTPM
|
string
|
Indicates Confidential VM disk with a ephemeral vTPM. vTPM state is not persisted across VM reboots.
|
ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey
|
string
|
Indicates Confidential VM disk with only VM guest state encrypted
|
TrustedLaunch
|
string
|
Trusted Launch provides security features such as secure boot and virtual Trusted Platform Module (vTPM)
|
DiskState
This enumerates the possible state of the disk.
Name |
Type |
Description |
ActiveSAS
|
string
|
The disk currently has an Active SAS Uri associated with it.
|
ActiveSASFrozen
|
string
|
The disk is attached to a VM in hibernated state and has an active SAS URI associated with it.
|
ActiveUpload
|
string
|
A disk is created for upload and a write token has been issued for uploading to it.
|
Attached
|
string
|
The disk is currently attached to a running VM.
|
Frozen
|
string
|
The disk is attached to a VM which is in hibernated state.
|
ReadyToUpload
|
string
|
A disk is ready to be created by upload by requesting a write token.
|
Reserved
|
string
|
The disk is attached to a stopped-deallocated VM.
|
Unattached
|
string
|
The disk is not being used and can be attached to a VM.
|
Encryption
Encryption at rest settings for disk or snapshot
Name |
Type |
Description |
diskEncryptionSetId
|
string
|
ResourceId of the disk encryption set to use for enabling encryption at rest.
|
type
|
EncryptionType
|
The type of key used to encrypt the data of the disk.
|
EncryptionSettingsCollection
Encryption settings for disk or snapshot
Name |
Type |
Description |
enabled
|
boolean
|
Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged.
|
encryptionSettings
|
EncryptionSettingsElement[]
|
A collection of encryption settings, one for each disk volume.
|
encryptionSettingsVersion
|
string
|
Describes what type of encryption is used for the disks. Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure Disk Encryption.
|
EncryptionSettingsElement
Encryption settings for one disk volume.
Name |
Type |
Description |
diskEncryptionKey
|
KeyVaultAndSecretReference
|
Key Vault Secret Url and vault id of the disk encryption key
|
keyEncryptionKey
|
KeyVaultAndKeyReference
|
Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key.
|
EncryptionType
The type of key used to encrypt the data of the disk.
Name |
Type |
Description |
EncryptionAtRestWithCustomerKey
|
string
|
Disk is encrypted at rest with Customer managed key that can be changed and revoked by a customer.
|
EncryptionAtRestWithPlatformAndCustomerKeys
|
string
|
Disk is encrypted at rest with 2 layers of encryption. One of the keys is Customer managed and the other key is Platform managed.
|
EncryptionAtRestWithPlatformKey
|
string
|
Disk is encrypted at rest with Platform managed key. It is the default encryption type. This is not a valid encryption type for disk encryption sets.
|
ExtendedLocation
The complex type of the extended location.
Name |
Type |
Description |
name
|
string
|
The name of the extended location.
|
type
|
ExtendedLocationTypes
|
The type of the extended location.
|
ExtendedLocationTypes
The type of the extended location.
Name |
Type |
Description |
EdgeZone
|
string
|
|
HyperVGeneration
The hypervisor generation of the Virtual Machine. Applicable to OS disks only.
Name |
Type |
Description |
V1
|
string
|
|
V2
|
string
|
|
ImageDiskReference
The source image used for creating the disk.
Name |
Type |
Description |
communityGalleryImageId
|
string
|
A relative uri containing a community Azure Compute Gallery image reference.
|
id
|
string
|
A relative uri containing either a Platform Image Repository, user image, or Azure Compute Gallery image reference.
|
lun
|
integer
|
If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null.
|
sharedGalleryImageId
|
string
|
A relative uri containing a direct shared Azure Compute Gallery image reference.
|
KeyVaultAndKeyReference
Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey
Name |
Type |
Description |
keyUrl
|
string
|
Url pointing to a key or secret in KeyVault
|
sourceVault
|
SourceVault
|
Resource id of the KeyVault containing the key or secret
|
KeyVaultAndSecretReference
Key Vault Secret Url and vault id of the encryption key
Name |
Type |
Description |
secretUrl
|
string
|
Url pointing to a key or secret in KeyVault
|
sourceVault
|
SourceVault
|
Resource id of the KeyVault containing the key or secret
|
NetworkAccessPolicy
Policy for accessing the disk via network.
Name |
Type |
Description |
AllowAll
|
string
|
The disk can be exported or uploaded to from any network.
|
AllowPrivate
|
string
|
The disk can be exported or uploaded to using a DiskAccess resource's private endpoints.
|
DenyAll
|
string
|
The disk cannot be exported.
|
OperatingSystemTypes
The Operating System type.
Name |
Type |
Description |
Linux
|
string
|
|
Windows
|
string
|
|
ProvisionedBandwidthCopyOption
If this field is set on a snapshot and createOption is CopyStart, the snapshot will be copied at a quicker speed.
Name |
Type |
Description |
Enhanced
|
string
|
|
None
|
string
|
|
PublicNetworkAccess
Policy for controlling export on the disk.
Name |
Type |
Description |
Disabled
|
string
|
You cannot access the underlying data of the disk publicly on the internet even when NetworkAccessPolicy is set to AllowAll. You can access the data via the SAS URI only from your trusted Azure VNET when NetworkAccessPolicy is set to AllowPrivate.
|
Enabled
|
string
|
You can generate a SAS URI to access the underlying data of the disk publicly on the internet when NetworkAccessPolicy is set to AllowAll. You can access the data via the SAS URI only from your trusted Azure VNET when NetworkAccessPolicy is set to AllowPrivate.
|
PurchasePlan
Used for establishing the purchase context of any 3rd Party artifact through MarketPlace.
Name |
Type |
Description |
name
|
string
|
The plan ID.
|
product
|
string
|
Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element.
|
promotionCode
|
string
|
The Offer Promotion Code.
|
publisher
|
string
|
The publisher ID.
|
Snapshot
Snapshot resource.
Name |
Type |
Description |
extendedLocation
|
ExtendedLocation
|
The extended location where the snapshot will be created. Extended location cannot be changed.
|
id
|
string
|
Resource Id
|
location
|
string
|
Resource location
|
managedBy
|
string
|
Unused. Always Null.
|
name
|
string
|
Resource name
|
properties.completionPercent
|
number
|
Percentage complete for the background copy when a resource is created via the CopyStart operation.
|
properties.copyCompletionError
|
CopyCompletionError
|
Indicates the error details if the background copy of a resource created via the CopyStart operation fails.
|
properties.creationData
|
CreationData
|
Disk source information. CreationData information cannot be changed after the disk has been created.
|
properties.dataAccessAuthMode
|
DataAccessAuthMode
|
Additional authentication requirements when exporting or uploading to a disk or snapshot.
|
properties.diskAccessId
|
string
|
ARM id of the DiskAccess resource for using private endpoints on disks.
|
properties.diskSizeBytes
|
integer
|
The size of the disk in bytes. This field is read only.
|
properties.diskSizeGB
|
integer
|
If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.
|
properties.diskState
|
DiskState
|
The state of the snapshot.
|
properties.encryption
|
Encryption
|
Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys.
|
properties.encryptionSettingsCollection
|
EncryptionSettingsCollection
|
Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot.
|
properties.hyperVGeneration
|
HyperVGeneration
|
The hypervisor generation of the Virtual Machine. Applicable to OS disks only.
|
properties.incremental
|
boolean
|
Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed.
|
properties.incrementalSnapshotFamilyId
|
string
|
Incremental snapshots for a disk share an incremental snapshot family id. The Get Page Range Diff API can only be called on incremental snapshots with the same family id.
|
properties.networkAccessPolicy
|
NetworkAccessPolicy
|
Policy for accessing the disk via network.
|
properties.osType
|
OperatingSystemTypes
|
The Operating System type.
|
properties.provisioningState
|
string
|
The disk provisioning state.
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
Policy for controlling export on the disk.
|
properties.purchasePlan
|
PurchasePlan
|
Purchase plan information for the image from which the source disk for the snapshot was originally created.
|
properties.securityProfile
|
DiskSecurityProfile
|
Contains the security related information for the resource.
|
properties.supportedCapabilities
|
SupportedCapabilities
|
List of supported capabilities for the image from which the source disk from the snapshot was originally created.
|
properties.supportsHibernation
|
boolean
|
Indicates the OS on a snapshot supports hibernation.
|
properties.timeCreated
|
string
|
The time when the snapshot was created.
|
properties.uniqueId
|
string
|
Unique Guid identifying the resource.
|
sku
|
SnapshotSku
|
The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot
|
tags
|
object
|
Resource tags
|
type
|
string
|
Resource type
|
SnapshotSku
The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot
SnapshotStorageAccountTypes
The sku name.
Name |
Type |
Description |
Premium_LRS
|
string
|
Premium SSD locally redundant storage
|
Standard_LRS
|
string
|
Standard HDD locally redundant storage
|
Standard_ZRS
|
string
|
Standard zone redundant storage
|
SourceVault
The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}
Name |
Type |
Description |
id
|
string
|
Resource Id
|
SupportedCapabilities
List of supported capabilities persisted on the disk resource for VM use.
Name |
Type |
Description |
acceleratedNetwork
|
boolean
|
True if the image from which the OS disk is created supports accelerated networking.
|
architecture
|
Architecture
|
CPU architecture supported by an OS disk.
|
diskControllerTypes
|
string
|
The disk controllers that an OS disk supports. If set it can be SCSI or SCSI, NVME or NVME, SCSI.
|