1. Packages
  2. Azure Classic
  3. API Docs
  4. storage
  5. ShareFile

We recommend using Azure Native.

Azure v6.12.0 published on Monday, Dec 2, 2024 by Pulumi

azure.storage.ShareFile

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure v6.12.0 published on Monday, Dec 2, 2024 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = new azure.core.ResourceGroup("example", {
        name: "example-resources",
        location: "West Europe",
    });
    const exampleAccount = new azure.storage.Account("example", {
        name: "azureteststorage",
        resourceGroupName: example.name,
        location: example.location,
        accountTier: "Standard",
        accountReplicationType: "LRS",
    });
    const exampleShare = new azure.storage.Share("example", {
        name: "sharename",
        storageAccountName: exampleAccount.name,
        quota: 50,
    });
    const exampleShareFile = new azure.storage.ShareFile("example", {
        name: "my-awesome-content.zip",
        storageShareId: exampleShare.id,
        source: "some-local-file.zip",
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.core.ResourceGroup("example",
        name="example-resources",
        location="West Europe")
    example_account = azure.storage.Account("example",
        name="azureteststorage",
        resource_group_name=example.name,
        location=example.location,
        account_tier="Standard",
        account_replication_type="LRS")
    example_share = azure.storage.Share("example",
        name="sharename",
        storage_account_name=example_account.name,
        quota=50)
    example_share_file = azure.storage.ShareFile("example",
        name="my-awesome-content.zip",
        storage_share_id=example_share.id,
        source="some-local-file.zip")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/storage"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
    			Name:     pulumi.String("example-resources"),
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
    			Name:                   pulumi.String("azureteststorage"),
    			ResourceGroupName:      example.Name,
    			Location:               example.Location,
    			AccountTier:            pulumi.String("Standard"),
    			AccountReplicationType: pulumi.String("LRS"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleShare, err := storage.NewShare(ctx, "example", &storage.ShareArgs{
    			Name:               pulumi.String("sharename"),
    			StorageAccountName: exampleAccount.Name,
    			Quota:              pulumi.Int(50),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = storage.NewShareFile(ctx, "example", &storage.ShareFileArgs{
    			Name:           pulumi.String("my-awesome-content.zip"),
    			StorageShareId: exampleShare.ID(),
    			Source:         pulumi.String("some-local-file.zip"),
    		})
    		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 example = new Azure.Core.ResourceGroup("example", new()
        {
            Name = "example-resources",
            Location = "West Europe",
        });
    
        var exampleAccount = new Azure.Storage.Account("example", new()
        {
            Name = "azureteststorage",
            ResourceGroupName = example.Name,
            Location = example.Location,
            AccountTier = "Standard",
            AccountReplicationType = "LRS",
        });
    
        var exampleShare = new Azure.Storage.Share("example", new()
        {
            Name = "sharename",
            StorageAccountName = exampleAccount.Name,
            Quota = 50,
        });
    
        var exampleShareFile = new Azure.Storage.ShareFile("example", new()
        {
            Name = "my-awesome-content.zip",
            StorageShareId = exampleShare.Id,
            Source = "some-local-file.zip",
        });
    
    });
    
    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.storage.Account;
    import com.pulumi.azure.storage.AccountArgs;
    import com.pulumi.azure.storage.Share;
    import com.pulumi.azure.storage.ShareArgs;
    import com.pulumi.azure.storage.ShareFile;
    import com.pulumi.azure.storage.ShareFileArgs;
    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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
                .name("example-resources")
                .location("West Europe")
                .build());
    
            var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
                .name("azureteststorage")
                .resourceGroupName(example.name())
                .location(example.location())
                .accountTier("Standard")
                .accountReplicationType("LRS")
                .build());
    
            var exampleShare = new Share("exampleShare", ShareArgs.builder()
                .name("sharename")
                .storageAccountName(exampleAccount.name())
                .quota(50)
                .build());
    
            var exampleShareFile = new ShareFile("exampleShareFile", ShareFileArgs.builder()
                .name("my-awesome-content.zip")
                .storageShareId(exampleShare.id())
                .source("some-local-file.zip")
                .build());
    
        }
    }
    
    resources:
      example:
        type: azure:core:ResourceGroup
        properties:
          name: example-resources
          location: West Europe
      exampleAccount:
        type: azure:storage:Account
        name: example
        properties:
          name: azureteststorage
          resourceGroupName: ${example.name}
          location: ${example.location}
          accountTier: Standard
          accountReplicationType: LRS
      exampleShare:
        type: azure:storage:Share
        name: example
        properties:
          name: sharename
          storageAccountName: ${exampleAccount.name}
          quota: 50
      exampleShareFile:
        type: azure:storage:ShareFile
        name: example
        properties:
          name: my-awesome-content.zip
          storageShareId: ${exampleShare.id}
          source: some-local-file.zip
    

    Create ShareFile Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ShareFile(name: string, args: ShareFileArgs, opts?: CustomResourceOptions);
    @overload
    def ShareFile(resource_name: str,
                  args: ShareFileArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def ShareFile(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  storage_share_id: Optional[str] = None,
                  content_disposition: Optional[str] = None,
                  content_encoding: Optional[str] = None,
                  content_md5: Optional[str] = None,
                  content_type: Optional[str] = None,
                  metadata: Optional[Mapping[str, str]] = None,
                  name: Optional[str] = None,
                  path: Optional[str] = None,
                  source: Optional[str] = None)
    func NewShareFile(ctx *Context, name string, args ShareFileArgs, opts ...ResourceOption) (*ShareFile, error)
    public ShareFile(string name, ShareFileArgs args, CustomResourceOptions? opts = null)
    public ShareFile(String name, ShareFileArgs args)
    public ShareFile(String name, ShareFileArgs args, CustomResourceOptions options)
    
    type: azure:storage:ShareFile
    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 ShareFileArgs
    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 ShareFileArgs
    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 ShareFileArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ShareFileArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ShareFileArgs
    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 shareFileResource = new Azure.Storage.ShareFile("shareFileResource", new()
    {
        StorageShareId = "string",
        ContentDisposition = "string",
        ContentEncoding = "string",
        ContentMd5 = "string",
        ContentType = "string",
        Metadata = 
        {
            { "string", "string" },
        },
        Name = "string",
        Path = "string",
        Source = "string",
    });
    
    example, err := storage.NewShareFile(ctx, "shareFileResource", &storage.ShareFileArgs{
    	StorageShareId:     pulumi.String("string"),
    	ContentDisposition: pulumi.String("string"),
    	ContentEncoding:    pulumi.String("string"),
    	ContentMd5:         pulumi.String("string"),
    	ContentType:        pulumi.String("string"),
    	Metadata: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Name:   pulumi.String("string"),
    	Path:   pulumi.String("string"),
    	Source: pulumi.String("string"),
    })
    
    var shareFileResource = new ShareFile("shareFileResource", ShareFileArgs.builder()
        .storageShareId("string")
        .contentDisposition("string")
        .contentEncoding("string")
        .contentMd5("string")
        .contentType("string")
        .metadata(Map.of("string", "string"))
        .name("string")
        .path("string")
        .source("string")
        .build());
    
    share_file_resource = azure.storage.ShareFile("shareFileResource",
        storage_share_id="string",
        content_disposition="string",
        content_encoding="string",
        content_md5="string",
        content_type="string",
        metadata={
            "string": "string",
        },
        name="string",
        path="string",
        source="string")
    
    const shareFileResource = new azure.storage.ShareFile("shareFileResource", {
        storageShareId: "string",
        contentDisposition: "string",
        contentEncoding: "string",
        contentMd5: "string",
        contentType: "string",
        metadata: {
            string: "string",
        },
        name: "string",
        path: "string",
        source: "string",
    });
    
    type: azure:storage:ShareFile
    properties:
        contentDisposition: string
        contentEncoding: string
        contentMd5: string
        contentType: string
        metadata:
            string: string
        name: string
        path: string
        source: string
        storageShareId: string
    

    ShareFile Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ShareFile resource accepts the following input properties:

    StorageShareId string
    The Storage Share ID in which this file will be placed into. Changing this forces a new resource to be created.
    ContentDisposition string
    Sets the file’s Content-Disposition header.
    ContentEncoding string
    Specifies which content encodings have been applied to the file.
    ContentMd5 string
    ContentType string
    The content type of the share file. Defaults to application/octet-stream.
    Metadata Dictionary<string, string>
    A mapping of metadata to assign to this file.
    Name string
    The name (or path) of the File that should be created within this File Share. Changing this forces a new resource to be created.
    Path string
    The storage share directory that you would like the file placed into. Changing this forces a new resource to be created. Defaults to "".
    Source string

    An absolute path to a file on the local system. Changing this forces a new resource to be created.

    Note The file specified with source can not be empty.

    StorageShareId string
    The Storage Share ID in which this file will be placed into. Changing this forces a new resource to be created.
    ContentDisposition string
    Sets the file’s Content-Disposition header.
    ContentEncoding string
    Specifies which content encodings have been applied to the file.
    ContentMd5 string
    ContentType string
    The content type of the share file. Defaults to application/octet-stream.
    Metadata map[string]string
    A mapping of metadata to assign to this file.
    Name string
    The name (or path) of the File that should be created within this File Share. Changing this forces a new resource to be created.
    Path string
    The storage share directory that you would like the file placed into. Changing this forces a new resource to be created. Defaults to "".
    Source string

    An absolute path to a file on the local system. Changing this forces a new resource to be created.

    Note The file specified with source can not be empty.

    storageShareId String
    The Storage Share ID in which this file will be placed into. Changing this forces a new resource to be created.
    contentDisposition String
    Sets the file’s Content-Disposition header.
    contentEncoding String
    Specifies which content encodings have been applied to the file.
    contentMd5 String
    contentType String
    The content type of the share file. Defaults to application/octet-stream.
    metadata Map<String,String>
    A mapping of metadata to assign to this file.
    name String
    The name (or path) of the File that should be created within this File Share. Changing this forces a new resource to be created.
    path String
    The storage share directory that you would like the file placed into. Changing this forces a new resource to be created. Defaults to "".
    source String

    An absolute path to a file on the local system. Changing this forces a new resource to be created.

    Note The file specified with source can not be empty.

    storageShareId string
    The Storage Share ID in which this file will be placed into. Changing this forces a new resource to be created.
    contentDisposition string
    Sets the file’s Content-Disposition header.
    contentEncoding string
    Specifies which content encodings have been applied to the file.
    contentMd5 string
    contentType string
    The content type of the share file. Defaults to application/octet-stream.
    metadata {[key: string]: string}
    A mapping of metadata to assign to this file.
    name string
    The name (or path) of the File that should be created within this File Share. Changing this forces a new resource to be created.
    path string
    The storage share directory that you would like the file placed into. Changing this forces a new resource to be created. Defaults to "".
    source string

    An absolute path to a file on the local system. Changing this forces a new resource to be created.

    Note The file specified with source can not be empty.

    storage_share_id str
    The Storage Share ID in which this file will be placed into. Changing this forces a new resource to be created.
    content_disposition str
    Sets the file’s Content-Disposition header.
    content_encoding str
    Specifies which content encodings have been applied to the file.
    content_md5 str
    content_type str
    The content type of the share file. Defaults to application/octet-stream.
    metadata Mapping[str, str]
    A mapping of metadata to assign to this file.
    name str
    The name (or path) of the File that should be created within this File Share. Changing this forces a new resource to be created.
    path str
    The storage share directory that you would like the file placed into. Changing this forces a new resource to be created. Defaults to "".
    source str

    An absolute path to a file on the local system. Changing this forces a new resource to be created.

    Note The file specified with source can not be empty.

    storageShareId String
    The Storage Share ID in which this file will be placed into. Changing this forces a new resource to be created.
    contentDisposition String
    Sets the file’s Content-Disposition header.
    contentEncoding String
    Specifies which content encodings have been applied to the file.
    contentMd5 String
    contentType String
    The content type of the share file. Defaults to application/octet-stream.
    metadata Map<String>
    A mapping of metadata to assign to this file.
    name String
    The name (or path) of the File that should be created within this File Share. Changing this forces a new resource to be created.
    path String
    The storage share directory that you would like the file placed into. Changing this forces a new resource to be created. Defaults to "".
    source String

    An absolute path to a file on the local system. Changing this forces a new resource to be created.

    Note The file specified with source can not be empty.

    Outputs

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

    ContentLength int
    The length in bytes of the file content
    Id string
    The provider-assigned unique ID for this managed resource.
    ContentLength int
    The length in bytes of the file content
    Id string
    The provider-assigned unique ID for this managed resource.
    contentLength Integer
    The length in bytes of the file content
    id String
    The provider-assigned unique ID for this managed resource.
    contentLength number
    The length in bytes of the file content
    id string
    The provider-assigned unique ID for this managed resource.
    content_length int
    The length in bytes of the file content
    id str
    The provider-assigned unique ID for this managed resource.
    contentLength Number
    The length in bytes of the file content
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ShareFile Resource

    Get an existing ShareFile 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?: ShareFileState, opts?: CustomResourceOptions): ShareFile
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            content_disposition: Optional[str] = None,
            content_encoding: Optional[str] = None,
            content_length: Optional[int] = None,
            content_md5: Optional[str] = None,
            content_type: Optional[str] = None,
            metadata: Optional[Mapping[str, str]] = None,
            name: Optional[str] = None,
            path: Optional[str] = None,
            source: Optional[str] = None,
            storage_share_id: Optional[str] = None) -> ShareFile
    func GetShareFile(ctx *Context, name string, id IDInput, state *ShareFileState, opts ...ResourceOption) (*ShareFile, error)
    public static ShareFile Get(string name, Input<string> id, ShareFileState? state, CustomResourceOptions? opts = null)
    public static ShareFile get(String name, Output<String> id, ShareFileState 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:
    ContentDisposition string
    Sets the file’s Content-Disposition header.
    ContentEncoding string
    Specifies which content encodings have been applied to the file.
    ContentLength int
    The length in bytes of the file content
    ContentMd5 string
    ContentType string
    The content type of the share file. Defaults to application/octet-stream.
    Metadata Dictionary<string, string>
    A mapping of metadata to assign to this file.
    Name string
    The name (or path) of the File that should be created within this File Share. Changing this forces a new resource to be created.
    Path string
    The storage share directory that you would like the file placed into. Changing this forces a new resource to be created. Defaults to "".
    Source string

    An absolute path to a file on the local system. Changing this forces a new resource to be created.

    Note The file specified with source can not be empty.

    StorageShareId string
    The Storage Share ID in which this file will be placed into. Changing this forces a new resource to be created.
    ContentDisposition string
    Sets the file’s Content-Disposition header.
    ContentEncoding string
    Specifies which content encodings have been applied to the file.
    ContentLength int
    The length in bytes of the file content
    ContentMd5 string
    ContentType string
    The content type of the share file. Defaults to application/octet-stream.
    Metadata map[string]string
    A mapping of metadata to assign to this file.
    Name string
    The name (or path) of the File that should be created within this File Share. Changing this forces a new resource to be created.
    Path string
    The storage share directory that you would like the file placed into. Changing this forces a new resource to be created. Defaults to "".
    Source string

    An absolute path to a file on the local system. Changing this forces a new resource to be created.

    Note The file specified with source can not be empty.

    StorageShareId string
    The Storage Share ID in which this file will be placed into. Changing this forces a new resource to be created.
    contentDisposition String
    Sets the file’s Content-Disposition header.
    contentEncoding String
    Specifies which content encodings have been applied to the file.
    contentLength Integer
    The length in bytes of the file content
    contentMd5 String
    contentType String
    The content type of the share file. Defaults to application/octet-stream.
    metadata Map<String,String>
    A mapping of metadata to assign to this file.
    name String
    The name (or path) of the File that should be created within this File Share. Changing this forces a new resource to be created.
    path String
    The storage share directory that you would like the file placed into. Changing this forces a new resource to be created. Defaults to "".
    source String

    An absolute path to a file on the local system. Changing this forces a new resource to be created.

    Note The file specified with source can not be empty.

    storageShareId String
    The Storage Share ID in which this file will be placed into. Changing this forces a new resource to be created.
    contentDisposition string
    Sets the file’s Content-Disposition header.
    contentEncoding string
    Specifies which content encodings have been applied to the file.
    contentLength number
    The length in bytes of the file content
    contentMd5 string
    contentType string
    The content type of the share file. Defaults to application/octet-stream.
    metadata {[key: string]: string}
    A mapping of metadata to assign to this file.
    name string
    The name (or path) of the File that should be created within this File Share. Changing this forces a new resource to be created.
    path string
    The storage share directory that you would like the file placed into. Changing this forces a new resource to be created. Defaults to "".
    source string

    An absolute path to a file on the local system. Changing this forces a new resource to be created.

    Note The file specified with source can not be empty.

    storageShareId string
    The Storage Share ID in which this file will be placed into. Changing this forces a new resource to be created.
    content_disposition str
    Sets the file’s Content-Disposition header.
    content_encoding str
    Specifies which content encodings have been applied to the file.
    content_length int
    The length in bytes of the file content
    content_md5 str
    content_type str
    The content type of the share file. Defaults to application/octet-stream.
    metadata Mapping[str, str]
    A mapping of metadata to assign to this file.
    name str
    The name (or path) of the File that should be created within this File Share. Changing this forces a new resource to be created.
    path str
    The storage share directory that you would like the file placed into. Changing this forces a new resource to be created. Defaults to "".
    source str

    An absolute path to a file on the local system. Changing this forces a new resource to be created.

    Note The file specified with source can not be empty.

    storage_share_id str
    The Storage Share ID in which this file will be placed into. Changing this forces a new resource to be created.
    contentDisposition String
    Sets the file’s Content-Disposition header.
    contentEncoding String
    Specifies which content encodings have been applied to the file.
    contentLength Number
    The length in bytes of the file content
    contentMd5 String
    contentType String
    The content type of the share file. Defaults to application/octet-stream.
    metadata Map<String>
    A mapping of metadata to assign to this file.
    name String
    The name (or path) of the File that should be created within this File Share. Changing this forces a new resource to be created.
    path String
    The storage share directory that you would like the file placed into. Changing this forces a new resource to be created. Defaults to "".
    source String

    An absolute path to a file on the local system. Changing this forces a new resource to be created.

    Note The file specified with source can not be empty.

    storageShareId String
    The Storage Share ID in which this file will be placed into. Changing this forces a new resource to be created.

    Import

    Directories within an Azure Storage File Share can be imported using the resource id, e.g.

    $ pulumi import azure:storage/shareFile:ShareFile example https://account1.file.core.windows.net/share1/file1
    

    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.
    azure logo

    We recommend using Azure Native.

    Azure v6.12.0 published on Monday, Dec 2, 2024 by Pulumi