azure logo
Azure Classic v5.43.0, May 6 23

azure.compute.ManagedDiskSasToken

Explore with Pulumi AI

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

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var testResourceGroup = new Azure.Core.ResourceGroup("testResourceGroup", new()
    {
        Location = "West Europe",
    });

    var testManagedDisk = new Azure.Compute.ManagedDisk("testManagedDisk", new()
    {
        Location = testResourceGroup.Location,
        ResourceGroupName = testResourceGroup.Name,
        StorageAccountType = "Standard_LRS",
        CreateOption = "Empty",
        DiskSizeGb = 1,
    });

    var testManagedDiskSasToken = new Azure.Compute.ManagedDiskSasToken("testManagedDiskSasToken", new()
    {
        ManagedDiskId = testManagedDisk.Id,
        DurationInSeconds = 300,
        AccessLevel = "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 {
		testResourceGroup, err := core.NewResourceGroup(ctx, "testResourceGroup", &core.ResourceGroupArgs{
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		testManagedDisk, err := compute.NewManagedDisk(ctx, "testManagedDisk", &compute.ManagedDiskArgs{
			Location:           testResourceGroup.Location,
			ResourceGroupName:  testResourceGroup.Name,
			StorageAccountType: pulumi.String("Standard_LRS"),
			CreateOption:       pulumi.String("Empty"),
			DiskSizeGb:         pulumi.Int(1),
		})
		if err != nil {
			return err
		}
		_, err = compute.NewManagedDiskSasToken(ctx, "testManagedDiskSasToken", &compute.ManagedDiskSasTokenArgs{
			ManagedDiskId:     testManagedDisk.ID(),
			DurationInSeconds: pulumi.Int(300),
			AccessLevel:       pulumi.String("Read"),
		})
		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.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 testResourceGroup = new ResourceGroup("testResourceGroup", ResourceGroupArgs.builder()        
            .location("West Europe")
            .build());

        var testManagedDisk = new ManagedDisk("testManagedDisk", ManagedDiskArgs.builder()        
            .location(testResourceGroup.location())
            .resourceGroupName(testResourceGroup.name())
            .storageAccountType("Standard_LRS")
            .createOption("Empty")
            .diskSizeGb("1")
            .build());

        var testManagedDiskSasToken = new ManagedDiskSasToken("testManagedDiskSasToken", ManagedDiskSasTokenArgs.builder()        
            .managedDiskId(testManagedDisk.id())
            .durationInSeconds(300)
            .accessLevel("Read")
            .build());

    }
}
import pulumi
import pulumi_azure as azure

test_resource_group = azure.core.ResourceGroup("testResourceGroup", location="West Europe")
test_managed_disk = azure.compute.ManagedDisk("testManagedDisk",
    location=test_resource_group.location,
    resource_group_name=test_resource_group.name,
    storage_account_type="Standard_LRS",
    create_option="Empty",
    disk_size_gb=1)
test_managed_disk_sas_token = azure.compute.ManagedDiskSasToken("testManagedDiskSasToken",
    managed_disk_id=test_managed_disk.id,
    duration_in_seconds=300,
    access_level="Read")
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const testResourceGroup = new azure.core.ResourceGroup("testResourceGroup", {location: "West Europe"});
const testManagedDisk = new azure.compute.ManagedDisk("testManagedDisk", {
    location: testResourceGroup.location,
    resourceGroupName: testResourceGroup.name,
    storageAccountType: "Standard_LRS",
    createOption: "Empty",
    diskSizeGb: 1,
});
const testManagedDiskSasToken = new azure.compute.ManagedDiskSasToken("testManagedDiskSasToken", {
    managedDiskId: testManagedDisk.id,
    durationInSeconds: 300,
    accessLevel: "Read",
});
resources:
  testResourceGroup:
    type: azure:core:ResourceGroup
    properties:
      location: West Europe
  testManagedDisk:
    type: azure:compute:ManagedDisk
    properties:
      location: ${testResourceGroup.location}
      resourceGroupName: ${testResourceGroup.name}
      storageAccountType: Standard_LRS
      createOption: Empty
      diskSizeGb: '1'
  testManagedDiskSasToken:
    type: azure:compute:ManagedDiskSasToken
    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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.