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

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
azure logo

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    Manages a File within an Azure Storage File Share.

    Example Usage

    using Pulumi;
    using Azure = Pulumi.Azure;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
            {
                Location = "West Europe",
            });
            var exampleAccount = new Azure.Storage.Account("exampleAccount", new Azure.Storage.AccountArgs
            {
                ResourceGroupName = exampleResourceGroup.Name,
                Location = exampleResourceGroup.Location,
                AccountTier = "Standard",
                AccountReplicationType = "LRS",
            });
            var exampleShare = new Azure.Storage.Share("exampleShare", new Azure.Storage.ShareArgs
            {
                StorageAccountName = exampleAccount.Name,
                Quota = 50,
            });
            var exampleShareFile = new Azure.Storage.ShareFile("exampleShareFile", new Azure.Storage.ShareFileArgs
            {
                StorageShareId = exampleShare.Id,
                Source = "some-local-file.zip",
            });
        }
    
    }
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/storage"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleAccount, err := storage.NewAccount(ctx, "exampleAccount", &storage.AccountArgs{
    			ResourceGroupName:      exampleResourceGroup.Name,
    			Location:               exampleResourceGroup.Location,
    			AccountTier:            pulumi.String("Standard"),
    			AccountReplicationType: pulumi.String("LRS"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleShare, err := storage.NewShare(ctx, "exampleShare", &storage.ShareArgs{
    			StorageAccountName: exampleAccount.Name,
    			Quota:              pulumi.Int(50),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = storage.NewShareFile(ctx, "exampleShareFile", &storage.ShareFileArgs{
    			StorageShareId: exampleShare.ID(),
    			Source:         pulumi.String("some-local-file.zip"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    

    Example coming soon!

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
    const exampleAccount = new azure.storage.Account("exampleAccount", {
        resourceGroupName: exampleResourceGroup.name,
        location: exampleResourceGroup.location,
        accountTier: "Standard",
        accountReplicationType: "LRS",
    });
    const exampleShare = new azure.storage.Share("exampleShare", {
        storageAccountName: exampleAccount.name,
        quota: 50,
    });
    const exampleShareFile = new azure.storage.ShareFile("exampleShareFile", {
        storageShareId: exampleShare.id,
        source: "some-local-file.zip",
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
    example_account = azure.storage.Account("exampleAccount",
        resource_group_name=example_resource_group.name,
        location=example_resource_group.location,
        account_tier="Standard",
        account_replication_type="LRS")
    example_share = azure.storage.Share("exampleShare",
        storage_account_name=example_account.name,
        quota=50)
    example_share_file = azure.storage.ShareFile("exampleShareFile",
        storage_share_id=example_share.id,
        source="some-local-file.zip")
    

    Example coming soon!

    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
    The MD5 sum of the file contents. Changing this forces a new resource to be created.
    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.
    Source string
    An absolute path to a file on the local system.
    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
    The MD5 sum of the file contents. Changing this forces a new resource to be created.
    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.
    Source string
    An absolute path to a file on the local system.
    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
    The MD5 sum of the file contents. Changing this forces a new resource to be created.
    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.
    source String
    An absolute path to a file on the local system.
    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
    The MD5 sum of the file contents. Changing this forces a new resource to be created.
    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.
    source string
    An absolute path to a file on the local system.
    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
    The MD5 sum of the file contents. Changing this forces a new resource to be created.
    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.
    source str
    An absolute path to a file on the local system.
    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
    The MD5 sum of the file contents. Changing this forces a new resource to be created.
    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.
    source String
    An absolute path to a file on the local system.

    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)
    resources:  _:    type: azure:storage:ShareFile    get:      id: ${id}
    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
    The MD5 sum of the file contents. Changing this forces a new resource to be created.
    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.
    Source string
    An absolute path to a file on the local system.
    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
    The MD5 sum of the file contents. Changing this forces a new resource to be created.
    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.
    Source string
    An absolute path to a file on the local system.
    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
    The MD5 sum of the file contents. Changing this forces a new resource to be created.
    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.
    source String
    An absolute path to a file on the local system.
    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
    The MD5 sum of the file contents. Changing this forces a new resource to be created.
    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.
    source string
    An absolute path to a file on the local system.
    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
    The MD5 sum of the file contents. Changing this forces a new resource to be created.
    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.
    source str
    An absolute path to a file on the local system.
    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
    The MD5 sum of the file contents. Changing this forces a new resource to be created.
    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.
    source String
    An absolute path to a file on the local system.
    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.

    Viewing docs for Azure v4.42.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial