SnapshotArgs

data class SnapshotArgs(val completionPercent: Output<Double>? = null, val copyCompletionError: Output<CopyCompletionErrorArgs>? = null, val creationData: Output<CreationDataArgs>? = null, val dataAccessAuthMode: Output<Either<String, DataAccessAuthMode>>? = null, val diskAccessId: Output<String>? = null, val diskSizeGB: Output<Int>? = null, val encryption: Output<EncryptionArgs>? = null, val encryptionSettingsCollection: Output<EncryptionSettingsCollectionArgs>? = null, val extendedLocation: Output<ExtendedLocationArgs>? = null, val hyperVGeneration: Output<Either<String, HyperVGeneration>>? = null, val incremental: Output<Boolean>? = null, val location: Output<String>? = null, val networkAccessPolicy: Output<Either<String, NetworkAccessPolicy>>? = null, val osType: Output<OperatingSystemTypes>? = null, val publicNetworkAccess: Output<Either<String, PublicNetworkAccess>>? = null, val purchasePlan: Output<PurchasePlanArgs>? = null, val resourceGroupName: Output<String>? = null, val securityProfile: Output<DiskSecurityProfileArgs>? = null, val sku: Output<SnapshotSkuArgs>? = null, val snapshotName: Output<String>? = null, val supportedCapabilities: Output<SupportedCapabilitiesArgs>? = null, val supportsHibernation: Output<Boolean>? = null, val tags: Output<Map<String, String>>? = null) : ConvertibleToJava<SnapshotArgs>

Snapshot resource. Uses Azure REST API version 2024-03-02. In version 2.x of the Azure Native provider, it used API version 2022-07-02. Other available API versions: 2022-07-02, 2023-01-02, 2023-04-02, 2023-10-02. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native compute [ApiVersion]. See the ../../../version-guide/#accessing-any-api-version-via-local-packages for details.

Example Usage

Create a snapshot by importing an unmanaged blob from a different subscription.

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var snapshot = new AzureNative.Compute.Snapshot("snapshot", new()
{
CreationData = new AzureNative.Compute.Inputs.CreationDataArgs
{
CreateOption = AzureNative.Compute.DiskCreateOption.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",
ResourceGroupName = "myResourceGroup",
SnapshotName = "mySnapshot1",
});
});
package main
import (
compute "github.com/pulumi/pulumi-azure-native-sdk/compute/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewSnapshot(ctx, "snapshot", &compute.SnapshotArgs{
CreationData: &compute.CreationDataArgs{
CreateOption: pulumi.String(compute.DiskCreateOptionImport),
SourceUri: pulumi.String("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
StorageAccountId: pulumi.String("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
},
Location: pulumi.String("West US"),
ResourceGroupName: pulumi.String("myResourceGroup"),
SnapshotName: pulumi.String("mySnapshot1"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.compute.Snapshot;
import com.pulumi.azurenative.compute.SnapshotArgs;
import com.pulumi.azurenative.compute.inputs.CreationDataArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var snapshot = new Snapshot("snapshot", SnapshotArgs.builder()
.creationData(CreationDataArgs.builder()
.createOption("Import")
.sourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")
.storageAccountId("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount")
.build())
.location("West US")
.resourceGroupName("myResourceGroup")
.snapshotName("mySnapshot1")
.build());
}
}

Create a snapshot by importing an unmanaged blob from the same subscription.

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var snapshot = new AzureNative.Compute.Snapshot("snapshot", new()
{
CreationData = new AzureNative.Compute.Inputs.CreationDataArgs
{
CreateOption = AzureNative.Compute.DiskCreateOption.Import,
SourceUri = "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
},
Location = "West US",
ResourceGroupName = "myResourceGroup",
SnapshotName = "mySnapshot1",
});
});
package main
import (
compute "github.com/pulumi/pulumi-azure-native-sdk/compute/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewSnapshot(ctx, "snapshot", &compute.SnapshotArgs{
CreationData: &compute.CreationDataArgs{
CreateOption: pulumi.String(compute.DiskCreateOptionImport),
SourceUri: pulumi.String("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
},
Location: pulumi.String("West US"),
ResourceGroupName: pulumi.String("myResourceGroup"),
SnapshotName: pulumi.String("mySnapshot1"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.compute.Snapshot;
import com.pulumi.azurenative.compute.SnapshotArgs;
import com.pulumi.azurenative.compute.inputs.CreationDataArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var snapshot = new Snapshot("snapshot", SnapshotArgs.builder()
.creationData(CreationDataArgs.builder()
.createOption("Import")
.sourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")
.build())
.location("West US")
.resourceGroupName("myResourceGroup")
.snapshotName("mySnapshot1")
.build());
}
}

Create a snapshot from an elastic san volume snapshot.

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var snapshot = new AzureNative.Compute.Snapshot("snapshot", new()
{
CreationData = new AzureNative.Compute.Inputs.CreationDataArgs
{
CreateOption = AzureNative.Compute.DiskCreateOption.CopyFromSanSnapshot,
ElasticSanResourceId = "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot",
},
Location = "West US",
ResourceGroupName = "myResourceGroup",
SnapshotName = "mySnapshot",
});
});
package main
import (
compute "github.com/pulumi/pulumi-azure-native-sdk/compute/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewSnapshot(ctx, "snapshot", &compute.SnapshotArgs{
CreationData: &compute.CreationDataArgs{
CreateOption: pulumi.String(compute.DiskCreateOptionCopyFromSanSnapshot),
ElasticSanResourceId: pulumi.String("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"),
},
Location: pulumi.String("West US"),
ResourceGroupName: pulumi.String("myResourceGroup"),
SnapshotName: pulumi.String("mySnapshot"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.compute.Snapshot;
import com.pulumi.azurenative.compute.SnapshotArgs;
import com.pulumi.azurenative.compute.inputs.CreationDataArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var snapshot = new Snapshot("snapshot", SnapshotArgs.builder()
.creationData(CreationDataArgs.builder()
.createOption("CopyFromSanSnapshot")
.elasticSanResourceId("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot")
.build())
.location("West US")
.resourceGroupName("myResourceGroup")
.snapshotName("mySnapshot")
.build());
}
}

Create a snapshot from an existing snapshot in the same or a different subscription in a different region with quicker copy speed.

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var snapshot = new AzureNative.Compute.Snapshot("snapshot", new()
{
CreationData = new AzureNative.Compute.Inputs.CreationDataArgs
{
CreateOption = AzureNative.Compute.DiskCreateOption.CopyStart,
ProvisionedBandwidthCopySpeed = AzureNative.Compute.ProvisionedBandwidthCopyOption.Enhanced,
SourceResourceId = "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1",
},
Location = "West US",
ResourceGroupName = "myResourceGroup",
SnapshotName = "mySnapshot2",
});
});
package main
import (
compute "github.com/pulumi/pulumi-azure-native-sdk/compute/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewSnapshot(ctx, "snapshot", &compute.SnapshotArgs{
CreationData: &compute.CreationDataArgs{
CreateOption: pulumi.String(compute.DiskCreateOptionCopyStart),
ProvisionedBandwidthCopySpeed: pulumi.String(compute.ProvisionedBandwidthCopyOptionEnhanced),
SourceResourceId: pulumi.String("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
},
Location: pulumi.String("West US"),
ResourceGroupName: pulumi.String("myResourceGroup"),
SnapshotName: pulumi.String("mySnapshot2"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.compute.Snapshot;
import com.pulumi.azurenative.compute.SnapshotArgs;
import com.pulumi.azurenative.compute.inputs.CreationDataArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var snapshot = new Snapshot("snapshot", SnapshotArgs.builder()
.creationData(CreationDataArgs.builder()
.createOption("CopyStart")
.provisionedBandwidthCopySpeed("Enhanced")
.sourceResourceId("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1")
.build())
.location("West US")
.resourceGroupName("myResourceGroup")
.snapshotName("mySnapshot2")
.build());
}
}

Create a snapshot from an existing snapshot in the same or a different subscription in a different region.

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var snapshot = new AzureNative.Compute.Snapshot("snapshot", new()
{
CreationData = new AzureNative.Compute.Inputs.CreationDataArgs
{
CreateOption = AzureNative.Compute.DiskCreateOption.CopyStart,
SourceResourceId = "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1",
},
Location = "West US",
ResourceGroupName = "myResourceGroup",
SnapshotName = "mySnapshot2",
});
});
package main
import (
compute "github.com/pulumi/pulumi-azure-native-sdk/compute/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewSnapshot(ctx, "snapshot", &compute.SnapshotArgs{
CreationData: &compute.CreationDataArgs{
CreateOption: pulumi.String(compute.DiskCreateOptionCopyStart),
SourceResourceId: pulumi.String("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
},
Location: pulumi.String("West US"),
ResourceGroupName: pulumi.String("myResourceGroup"),
SnapshotName: pulumi.String("mySnapshot2"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.compute.Snapshot;
import com.pulumi.azurenative.compute.SnapshotArgs;
import com.pulumi.azurenative.compute.inputs.CreationDataArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var snapshot = new Snapshot("snapshot", SnapshotArgs.builder()
.creationData(CreationDataArgs.builder()
.createOption("CopyStart")
.sourceResourceId("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1")
.build())
.location("West US")
.resourceGroupName("myResourceGroup")
.snapshotName("mySnapshot2")
.build());
}
}

Create a snapshot from an existing snapshot in the same or a different subscription.

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var snapshot = new AzureNative.Compute.Snapshot("snapshot", new()
{
CreationData = new AzureNative.Compute.Inputs.CreationDataArgs
{
CreateOption = AzureNative.Compute.DiskCreateOption.Copy,
SourceResourceId = "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1",
},
Location = "West US",
ResourceGroupName = "myResourceGroup",
SnapshotName = "mySnapshot2",
});
});
package main
import (
compute "github.com/pulumi/pulumi-azure-native-sdk/compute/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewSnapshot(ctx, "snapshot", &compute.SnapshotArgs{
CreationData: &compute.CreationDataArgs{
CreateOption: pulumi.String(compute.DiskCreateOptionCopy),
SourceResourceId: pulumi.String("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"),
},
Location: pulumi.String("West US"),
ResourceGroupName: pulumi.String("myResourceGroup"),
SnapshotName: pulumi.String("mySnapshot2"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.compute.Snapshot;
import com.pulumi.azurenative.compute.SnapshotArgs;
import com.pulumi.azurenative.compute.inputs.CreationDataArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var snapshot = new Snapshot("snapshot", SnapshotArgs.builder()
.creationData(CreationDataArgs.builder()
.createOption("Copy")
.sourceResourceId("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1")
.build())
.location("West US")
.resourceGroupName("myResourceGroup")
.snapshotName("mySnapshot2")
.build());
}
}

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:compute:Snapshot mySnapshot2 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}

Constructors

Link copied to clipboard
constructor(completionPercent: Output<Double>? = null, copyCompletionError: Output<CopyCompletionErrorArgs>? = null, creationData: Output<CreationDataArgs>? = null, dataAccessAuthMode: Output<Either<String, DataAccessAuthMode>>? = null, diskAccessId: Output<String>? = null, diskSizeGB: Output<Int>? = null, encryption: Output<EncryptionArgs>? = null, encryptionSettingsCollection: Output<EncryptionSettingsCollectionArgs>? = null, extendedLocation: Output<ExtendedLocationArgs>? = null, hyperVGeneration: Output<Either<String, HyperVGeneration>>? = null, incremental: Output<Boolean>? = null, location: Output<String>? = null, networkAccessPolicy: Output<Either<String, NetworkAccessPolicy>>? = null, osType: Output<OperatingSystemTypes>? = null, publicNetworkAccess: Output<Either<String, PublicNetworkAccess>>? = null, purchasePlan: Output<PurchasePlanArgs>? = null, resourceGroupName: Output<String>? = null, securityProfile: Output<DiskSecurityProfileArgs>? = null, sku: Output<SnapshotSkuArgs>? = null, snapshotName: Output<String>? = null, supportedCapabilities: Output<SupportedCapabilitiesArgs>? = null, supportsHibernation: Output<Boolean>? = null, tags: Output<Map<String, String>>? = null)

Properties

Link copied to clipboard
val completionPercent: Output<Double>? = null

Percentage complete for the background copy when a resource is created via the CopyStart operation.

Link copied to clipboard

Indicates the error details if the background copy of a resource created via the CopyStart operation fails.

Link copied to clipboard
val creationData: Output<CreationDataArgs>? = null

Disk source information. CreationData information cannot be changed after the disk has been created.

Link copied to clipboard
val dataAccessAuthMode: Output<Either<String, DataAccessAuthMode>>? = null

Additional authentication requirements when exporting or uploading to a disk or snapshot.

Link copied to clipboard
val diskAccessId: Output<String>? = null

ARM id of the DiskAccess resource for using private endpoints on disks.

Link copied to clipboard
val diskSizeGB: Output<Int>? = null

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.

Link copied to clipboard
val encryption: Output<EncryptionArgs>? = null

Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys.

Link copied to clipboard

Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot.

Link copied to clipboard

The extended location where the snapshot will be created. Extended location cannot be changed.

Link copied to clipboard
val hyperVGeneration: Output<Either<String, HyperVGeneration>>? = null

The hypervisor generation of the Virtual Machine. Applicable to OS disks only.

Link copied to clipboard
val incremental: Output<Boolean>? = null

Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed.

Link copied to clipboard
val location: Output<String>? = null

Resource location

Link copied to clipboard
val networkAccessPolicy: Output<Either<String, NetworkAccessPolicy>>? = null

Policy for accessing the disk via network.

Link copied to clipboard
val osType: Output<OperatingSystemTypes>? = null

The Operating System type.

Link copied to clipboard
val publicNetworkAccess: Output<Either<String, PublicNetworkAccess>>? = null

Policy for controlling export on the disk.

Link copied to clipboard
val purchasePlan: Output<PurchasePlanArgs>? = null

Purchase plan information for the image from which the source disk for the snapshot was originally created.

Link copied to clipboard
val resourceGroupName: Output<String>? = null

The name of the resource group.

Link copied to clipboard

Contains the security related information for the resource.

Link copied to clipboard
val sku: Output<SnapshotSkuArgs>? = null

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

Link copied to clipboard
val snapshotName: Output<String>? = null

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.

Link copied to clipboard

List of supported capabilities for the image from which the source disk from the snapshot was originally created.

Link copied to clipboard
val supportsHibernation: Output<Boolean>? = null

Indicates the OS on a snapshot supports hibernation.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

Resource tags

Functions

Link copied to clipboard
open override fun toJava(): SnapshotArgs