We recommend using Azure Native.
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
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/v6/go/azure/compute"
"github.com/pulumi/pulumi-azure/sdk/v6/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
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ManagedDiskSasToken(name: string, args: ManagedDiskSasTokenArgs, opts?: CustomResourceOptions);
@overload
def ManagedDiskSasToken(resource_name: str,
args: ManagedDiskSasTokenArgs,
opts: Optional[ResourceOptions] = None)
@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)
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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var managedDiskSasTokenResource = new Azure.Compute.ManagedDiskSasToken("managedDiskSasTokenResource", new()
{
AccessLevel = "string",
DurationInSeconds = 0,
ManagedDiskId = "string",
});
example, err := compute.NewManagedDiskSasToken(ctx, "managedDiskSasTokenResource", &compute.ManagedDiskSasTokenArgs{
AccessLevel: pulumi.String("string"),
DurationInSeconds: pulumi.Int(0),
ManagedDiskId: pulumi.String("string"),
})
var managedDiskSasTokenResource = new ManagedDiskSasToken("managedDiskSasTokenResource", ManagedDiskSasTokenArgs.builder()
.accessLevel("string")
.durationInSeconds(0)
.managedDiskId("string")
.build());
managed_disk_sas_token_resource = azure.compute.ManagedDiskSasToken("managedDiskSasTokenResource",
access_level="string",
duration_in_seconds=0,
managed_disk_id="string")
const managedDiskSasTokenResource = new azure.compute.ManagedDiskSasToken("managedDiskSasTokenResource", {
accessLevel: "string",
durationInSeconds: 0,
managedDiskId: "string",
});
type: azure:compute:ManagedDiskSasToken
properties:
accessLevel: string
durationInSeconds: 0
managedDiskId: string
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:
- Access
Level 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.
- Duration
In intSeconds - 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 stringId - The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
- Access
Level 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.
- Duration
In intSeconds - 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 stringId - The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
- access
Level 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.
- duration
In IntegerSeconds - 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 StringId - The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
- access
Level 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.
- duration
In numberSeconds - 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 stringId - 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_ intseconds - 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_ strid - The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
- access
Level 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.
- duration
In NumberSeconds - 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 StringId - 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:
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.
- Access
Level 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.
- Duration
In intSeconds - 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 stringId - The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
- Sas
Url string - The computed Shared Access Signature (SAS) of the Managed Disk.
- Access
Level 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.
- Duration
In intSeconds - 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 stringId - The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
- Sas
Url string - The computed Shared Access Signature (SAS) of the Managed Disk.
- access
Level 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.
- duration
In IntegerSeconds - 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 StringId - The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
- sas
Url String - The computed Shared Access Signature (SAS) of the Managed Disk.
- access
Level 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.
- duration
In numberSeconds - 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 stringId - The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
- sas
Url 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_ intseconds - 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_ strid - 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.
- access
Level 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.
- duration
In NumberSeconds - 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 StringId - The ID of an existing Managed Disk which should be exported. Changing this forces a new resource to be created.
- sas
Url 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
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurerm
Terraform Provider.