1. Packages
  2. Azure Classic
  3. API Docs
  4. compute
  5. ManagedDiskSasToken

We recommend using Azure Native.

Azure Classic v5.70.0 published on Wednesday, Mar 27, 2024 by Pulumi

azure.compute.ManagedDiskSasToken

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.70.0 published on Wednesday, Mar 27, 2024 by Pulumi

    Manages a Disk SAS Token.

    Use this resource to obtain a Shared Access Signature (SAS Token) for an existing Managed Disk.

    Shared access signatures allow fine-grained, ephemeral access control to various aspects of Managed Disk similar to blob/storage account container.

    With the help of this resource, data from the disk can be copied from managed disk to a storage blob or to some other system without the need of azcopy.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const test = new azure.core.ResourceGroup("test", {
        name: "testrg",
        location: "West Europe",
    });
    const testManagedDisk = new azure.compute.ManagedDisk("test", {
        name: "tst-disk-export",
        location: test.location,
        resourceGroupName: test.name,
        storageAccountType: "Standard_LRS",
        createOption: "Empty",
        diskSizeGb: 1,
    });
    const testManagedDiskSasToken = new azure.compute.ManagedDiskSasToken("test", {
        managedDiskId: testManagedDisk.id,
        durationInSeconds: 300,
        accessLevel: "Read",
    });
    
    import pulumi
    import pulumi_azure as azure
    
    test = azure.core.ResourceGroup("test",
        name="testrg",
        location="West Europe")
    test_managed_disk = azure.compute.ManagedDisk("test",
        name="tst-disk-export",
        location=test.location,
        resource_group_name=test.name,
        storage_account_type="Standard_LRS",
        create_option="Empty",
        disk_size_gb=1)
    test_managed_disk_sas_token = azure.compute.ManagedDiskSasToken("test",
        managed_disk_id=test_managed_disk.id,
        duration_in_seconds=300,
        access_level="Read")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/compute"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		test, err := core.NewResourceGroup(ctx, "test", &core.ResourceGroupArgs{
    			Name:     pulumi.String("testrg"),
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		testManagedDisk, err := compute.NewManagedDisk(ctx, "test", &compute.ManagedDiskArgs{
    			Name:               pulumi.String("tst-disk-export"),
    			Location:           test.Location,
    			ResourceGroupName:  test.Name,
    			StorageAccountType: pulumi.String("Standard_LRS"),
    			CreateOption:       pulumi.String("Empty"),
    			DiskSizeGb:         pulumi.Int(1),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewManagedDiskSasToken(ctx, "test", &compute.ManagedDiskSasTokenArgs{
    			ManagedDiskId:     testManagedDisk.ID(),
    			DurationInSeconds: pulumi.Int(300),
    			AccessLevel:       pulumi.String("Read"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var test = new Azure.Core.ResourceGroup("test", new()
        {
            Name = "testrg",
            Location = "West Europe",
        });
    
        var testManagedDisk = new Azure.Compute.ManagedDisk("test", new()
        {
            Name = "tst-disk-export",
            Location = test.Location,
            ResourceGroupName = test.Name,
            StorageAccountType = "Standard_LRS",
            CreateOption = "Empty",
            DiskSizeGb = 1,
        });
    
        var testManagedDiskSasToken = new Azure.Compute.ManagedDiskSasToken("test", new()
        {
            ManagedDiskId = testManagedDisk.Id,
            DurationInSeconds = 300,
            AccessLevel = "Read",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.core.ResourceGroup;
    import com.pulumi.azure.core.ResourceGroupArgs;
    import com.pulumi.azure.compute.ManagedDisk;
    import com.pulumi.azure.compute.ManagedDiskArgs;
    import com.pulumi.azure.compute.ManagedDiskSasToken;
    import com.pulumi.azure.compute.ManagedDiskSasTokenArgs;
    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 test = new ResourceGroup("test", ResourceGroupArgs.builder()        
                .name("testrg")
                .location("West Europe")
                .build());
    
            var testManagedDisk = new ManagedDisk("testManagedDisk", ManagedDiskArgs.builder()        
                .name("tst-disk-export")
                .location(test.location())
                .resourceGroupName(test.name())
                .storageAccountType("Standard_LRS")
                .createOption("Empty")
                .diskSizeGb("1")
                .build());
    
            var testManagedDiskSasToken = new ManagedDiskSasToken("testManagedDiskSasToken", ManagedDiskSasTokenArgs.builder()        
                .managedDiskId(testManagedDisk.id())
                .durationInSeconds(300)
                .accessLevel("Read")
                .build());
    
        }
    }
    
    resources:
      test:
        type: azure:core:ResourceGroup
        properties:
          name: testrg
          location: West Europe
      testManagedDisk:
        type: azure:compute:ManagedDisk
        name: test
        properties:
          name: tst-disk-export
          location: ${test.location}
          resourceGroupName: ${test.name}
          storageAccountType: Standard_LRS
          createOption: Empty
          diskSizeGb: '1'
      testManagedDiskSasToken:
        type: azure:compute:ManagedDiskSasToken
        name: test
        properties:
          managedDiskId: ${testManagedDisk.id}
          durationInSeconds: 300
          accessLevel: Read
    

    Create ManagedDiskSasToken Resource

    new ManagedDiskSasToken(name: string, args: ManagedDiskSasTokenArgs, opts?: CustomResourceOptions);
    @overload
    def ManagedDiskSasToken(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            access_level: Optional[str] = None,
                            duration_in_seconds: Optional[int] = None,
                            managed_disk_id: Optional[str] = None)
    @overload
    def ManagedDiskSasToken(resource_name: str,
                            args: ManagedDiskSasTokenArgs,
                            opts: Optional[ResourceOptions] = None)
    func NewManagedDiskSasToken(ctx *Context, name string, args ManagedDiskSasTokenArgs, opts ...ResourceOption) (*ManagedDiskSasToken, error)
    public ManagedDiskSasToken(string name, ManagedDiskSasTokenArgs args, CustomResourceOptions? opts = null)
    public ManagedDiskSasToken(String name, ManagedDiskSasTokenArgs args)
    public ManagedDiskSasToken(String name, ManagedDiskSasTokenArgs args, CustomResourceOptions options)
    
    type: azure:compute:ManagedDiskSasToken
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args ManagedDiskSasTokenArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ManagedDiskSasTokenArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ManagedDiskSasTokenArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ManagedDiskSasTokenArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ManagedDiskSasTokenArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    ManagedDiskSasToken Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The ManagedDiskSasToken resource accepts the following input properties:

    AccessLevel string

    The level of access required on the disk. Supported are Read, Write. Changing this forces a new resource to be created.

    Refer to the SAS creation reference from Azure for additional details on the fields above.

    DurationInSeconds int
    The duration for which the export should be allowed. Should be between 30 & 4294967295 seconds. Changing this forces a new resource to be created.
    ManagedDiskId string
    The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
    AccessLevel string

    The level of access required on the disk. Supported are Read, Write. Changing this forces a new resource to be created.

    Refer to the SAS creation reference from Azure for additional details on the fields above.

    DurationInSeconds int
    The duration for which the export should be allowed. Should be between 30 & 4294967295 seconds. Changing this forces a new resource to be created.
    ManagedDiskId string
    The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
    accessLevel String

    The level of access required on the disk. Supported are Read, Write. Changing this forces a new resource to be created.

    Refer to the SAS creation reference from Azure for additional details on the fields above.

    durationInSeconds Integer
    The duration for which the export should be allowed. Should be between 30 & 4294967295 seconds. Changing this forces a new resource to be created.
    managedDiskId String
    The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
    accessLevel string

    The level of access required on the disk. Supported are Read, Write. Changing this forces a new resource to be created.

    Refer to the SAS creation reference from Azure for additional details on the fields above.

    durationInSeconds number
    The duration for which the export should be allowed. Should be between 30 & 4294967295 seconds. Changing this forces a new resource to be created.
    managedDiskId string
    The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
    access_level str

    The level of access required on the disk. Supported are Read, Write. Changing this forces a new resource to be created.

    Refer to the SAS creation reference from Azure for additional details on the fields above.

    duration_in_seconds int
    The duration for which the export should be allowed. Should be between 30 & 4294967295 seconds. Changing this forces a new resource to be created.
    managed_disk_id str
    The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
    accessLevel String

    The level of access required on the disk. Supported are Read, Write. Changing this forces a new resource to be created.

    Refer to the SAS creation reference from Azure for additional details on the fields above.

    durationInSeconds Number
    The duration for which the export should be allowed. Should be between 30 & 4294967295 seconds. Changing this forces a new resource to be created.
    managedDiskId String
    The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ManagedDiskSasToken resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    SasUrl string
    The computed Shared Access Signature (SAS) of the Managed Disk.
    Id string
    The provider-assigned unique ID for this managed resource.
    SasUrl string
    The computed Shared Access Signature (SAS) of the Managed Disk.
    id String
    The provider-assigned unique ID for this managed resource.
    sasUrl String
    The computed Shared Access Signature (SAS) of the Managed Disk.
    id string
    The provider-assigned unique ID for this managed resource.
    sasUrl string
    The computed Shared Access Signature (SAS) of the Managed Disk.
    id str
    The provider-assigned unique ID for this managed resource.
    sas_url str
    The computed Shared Access Signature (SAS) of the Managed Disk.
    id String
    The provider-assigned unique ID for this managed resource.
    sasUrl String
    The computed Shared Access Signature (SAS) of the Managed Disk.

    Look up Existing ManagedDiskSasToken Resource

    Get an existing ManagedDiskSasToken resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ManagedDiskSasTokenState, opts?: CustomResourceOptions): ManagedDiskSasToken
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            access_level: Optional[str] = None,
            duration_in_seconds: Optional[int] = None,
            managed_disk_id: Optional[str] = None,
            sas_url: Optional[str] = None) -> ManagedDiskSasToken
    func GetManagedDiskSasToken(ctx *Context, name string, id IDInput, state *ManagedDiskSasTokenState, opts ...ResourceOption) (*ManagedDiskSasToken, error)
    public static ManagedDiskSasToken Get(string name, Input<string> id, ManagedDiskSasTokenState? state, CustomResourceOptions? opts = null)
    public static ManagedDiskSasToken get(String name, Output<String> id, ManagedDiskSasTokenState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    AccessLevel string

    The level of access required on the disk. Supported are Read, Write. Changing this forces a new resource to be created.

    Refer to the SAS creation reference from Azure for additional details on the fields above.

    DurationInSeconds int
    The duration for which the export should be allowed. Should be between 30 & 4294967295 seconds. Changing this forces a new resource to be created.
    ManagedDiskId string
    The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
    SasUrl string
    The computed Shared Access Signature (SAS) of the Managed Disk.
    AccessLevel string

    The level of access required on the disk. Supported are Read, Write. Changing this forces a new resource to be created.

    Refer to the SAS creation reference from Azure for additional details on the fields above.

    DurationInSeconds int
    The duration for which the export should be allowed. Should be between 30 & 4294967295 seconds. Changing this forces a new resource to be created.
    ManagedDiskId string
    The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
    SasUrl string
    The computed Shared Access Signature (SAS) of the Managed Disk.
    accessLevel String

    The level of access required on the disk. Supported are Read, Write. Changing this forces a new resource to be created.

    Refer to the SAS creation reference from Azure for additional details on the fields above.

    durationInSeconds Integer
    The duration for which the export should be allowed. Should be between 30 & 4294967295 seconds. Changing this forces a new resource to be created.
    managedDiskId String
    The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
    sasUrl String
    The computed Shared Access Signature (SAS) of the Managed Disk.
    accessLevel string

    The level of access required on the disk. Supported are Read, Write. Changing this forces a new resource to be created.

    Refer to the SAS creation reference from Azure for additional details on the fields above.

    durationInSeconds number
    The duration for which the export should be allowed. Should be between 30 & 4294967295 seconds. Changing this forces a new resource to be created.
    managedDiskId string
    The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
    sasUrl string
    The computed Shared Access Signature (SAS) of the Managed Disk.
    access_level str

    The level of access required on the disk. Supported are Read, Write. Changing this forces a new resource to be created.

    Refer to the SAS creation reference from Azure for additional details on the fields above.

    duration_in_seconds int
    The duration for which the export should be allowed. Should be between 30 & 4294967295 seconds. Changing this forces a new resource to be created.
    managed_disk_id str
    The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
    sas_url str
    The computed Shared Access Signature (SAS) of the Managed Disk.
    accessLevel String

    The level of access required on the disk. Supported are Read, Write. Changing this forces a new resource to be created.

    Refer to the SAS creation reference from Azure for additional details on the fields above.

    durationInSeconds Number
    The duration for which the export should be allowed. Should be between 30 & 4294967295 seconds. Changing this forces a new resource to be created.
    managedDiskId String
    The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
    sasUrl String
    The computed Shared Access Signature (SAS) of the Managed Disk.

    Import

    Disk SAS Token can be imported using the resource id, e.g.

    $ pulumi import azure:compute/managedDiskSasToken:ManagedDiskSasToken example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/disks/manageddisk1
    

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.70.0 published on Wednesday, Mar 27, 2024 by Pulumi