1. Packages
  2. Azure Classic
  3. API Docs
  4. datashare
  5. Share

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.datashare.Share

Explore with Pulumi AI

Manages a Data Share.

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.datashare.Account("example", {
    name: "example-dsa",
    location: example.location,
    resourceGroupName: example.name,
    identity: {
        type: "SystemAssigned",
    },
    tags: {
        foo: "bar",
    },
});
const exampleShare = new azure.datashare.Share("example", {
    name: "example_dss",
    accountId: exampleAccount.id,
    kind: "CopyBased",
    description: "example desc",
    terms: "example terms",
    snapshotSchedule: {
        name: "example-ss",
        recurrence: "Day",
        startTime: "2020-04-17T04:47:52.9614956Z",
    },
});
Copy
import pulumi
import pulumi_azure as azure

example = azure.core.ResourceGroup("example",
    name="example-resources",
    location="West Europe")
example_account = azure.datashare.Account("example",
    name="example-dsa",
    location=example.location,
    resource_group_name=example.name,
    identity={
        "type": "SystemAssigned",
    },
    tags={
        "foo": "bar",
    })
example_share = azure.datashare.Share("example",
    name="example_dss",
    account_id=example_account.id,
    kind="CopyBased",
    description="example desc",
    terms="example terms",
    snapshot_schedule={
        "name": "example-ss",
        "recurrence": "Day",
        "start_time": "2020-04-17T04:47:52.9614956Z",
    })
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/datashare"
	"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 := datashare.NewAccount(ctx, "example", &datashare.AccountArgs{
			Name:              pulumi.String("example-dsa"),
			Location:          example.Location,
			ResourceGroupName: example.Name,
			Identity: &datashare.AccountIdentityArgs{
				Type: pulumi.String("SystemAssigned"),
			},
			Tags: pulumi.StringMap{
				"foo": pulumi.String("bar"),
			},
		})
		if err != nil {
			return err
		}
		_, err = datashare.NewShare(ctx, "example", &datashare.ShareArgs{
			Name:        pulumi.String("example_dss"),
			AccountId:   exampleAccount.ID(),
			Kind:        pulumi.String("CopyBased"),
			Description: pulumi.String("example desc"),
			Terms:       pulumi.String("example terms"),
			SnapshotSchedule: &datashare.ShareSnapshotScheduleArgs{
				Name:       pulumi.String("example-ss"),
				Recurrence: pulumi.String("Day"),
				StartTime:  pulumi.String("2020-04-17T04:47:52.9614956Z"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
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.DataShare.Account("example", new()
    {
        Name = "example-dsa",
        Location = example.Location,
        ResourceGroupName = example.Name,
        Identity = new Azure.DataShare.Inputs.AccountIdentityArgs
        {
            Type = "SystemAssigned",
        },
        Tags = 
        {
            { "foo", "bar" },
        },
    });

    var exampleShare = new Azure.DataShare.Share("example", new()
    {
        Name = "example_dss",
        AccountId = exampleAccount.Id,
        Kind = "CopyBased",
        Description = "example desc",
        Terms = "example terms",
        SnapshotSchedule = new Azure.DataShare.Inputs.ShareSnapshotScheduleArgs
        {
            Name = "example-ss",
            Recurrence = "Day",
            StartTime = "2020-04-17T04:47:52.9614956Z",
        },
    });

});
Copy
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.datashare.Account;
import com.pulumi.azure.datashare.AccountArgs;
import com.pulumi.azure.datashare.inputs.AccountIdentityArgs;
import com.pulumi.azure.datashare.Share;
import com.pulumi.azure.datashare.ShareArgs;
import com.pulumi.azure.datashare.inputs.ShareSnapshotScheduleArgs;
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("example-dsa")
            .location(example.location())
            .resourceGroupName(example.name())
            .identity(AccountIdentityArgs.builder()
                .type("SystemAssigned")
                .build())
            .tags(Map.of("foo", "bar"))
            .build());

        var exampleShare = new Share("exampleShare", ShareArgs.builder()
            .name("example_dss")
            .accountId(exampleAccount.id())
            .kind("CopyBased")
            .description("example desc")
            .terms("example terms")
            .snapshotSchedule(ShareSnapshotScheduleArgs.builder()
                .name("example-ss")
                .recurrence("Day")
                .startTime("2020-04-17T04:47:52.9614956Z")
                .build())
            .build());

    }
}
Copy
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-resources
      location: West Europe
  exampleAccount:
    type: azure:datashare:Account
    name: example
    properties:
      name: example-dsa
      location: ${example.location}
      resourceGroupName: ${example.name}
      identity:
        type: SystemAssigned
      tags:
        foo: bar
  exampleShare:
    type: azure:datashare:Share
    name: example
    properties:
      name: example_dss
      accountId: ${exampleAccount.id}
      kind: CopyBased
      description: example desc
      terms: example terms
      snapshotSchedule:
        name: example-ss
        recurrence: Day
        startTime: 2020-04-17T04:47:52.9614956Z
Copy

Create Share Resource

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

Constructor syntax

new Share(name: string, args: ShareArgs, opts?: CustomResourceOptions);
@overload
def Share(resource_name: str,
          args: ShareArgs,
          opts: Optional[ResourceOptions] = None)

@overload
def Share(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          account_id: Optional[str] = None,
          kind: Optional[str] = None,
          description: Optional[str] = None,
          name: Optional[str] = None,
          snapshot_schedule: Optional[ShareSnapshotScheduleArgs] = None,
          terms: Optional[str] = None)
func NewShare(ctx *Context, name string, args ShareArgs, opts ...ResourceOption) (*Share, error)
public Share(string name, ShareArgs args, CustomResourceOptions? opts = null)
public Share(String name, ShareArgs args)
public Share(String name, ShareArgs args, CustomResourceOptions options)
type: azure:datashare:Share
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ShareArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ShareArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ShareArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ShareArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ShareArgs
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 shareResource = new Azure.DataShare.Share("shareResource", new()
{
    AccountId = "string",
    Kind = "string",
    Description = "string",
    Name = "string",
    SnapshotSchedule = new Azure.DataShare.Inputs.ShareSnapshotScheduleArgs
    {
        Name = "string",
        Recurrence = "string",
        StartTime = "string",
    },
    Terms = "string",
});
Copy
example, err := datashare.NewShare(ctx, "shareResource", &datashare.ShareArgs{
	AccountId:   pulumi.String("string"),
	Kind:        pulumi.String("string"),
	Description: pulumi.String("string"),
	Name:        pulumi.String("string"),
	SnapshotSchedule: &datashare.ShareSnapshotScheduleArgs{
		Name:       pulumi.String("string"),
		Recurrence: pulumi.String("string"),
		StartTime:  pulumi.String("string"),
	},
	Terms: pulumi.String("string"),
})
Copy
var shareResource = new Share("shareResource", ShareArgs.builder()
    .accountId("string")
    .kind("string")
    .description("string")
    .name("string")
    .snapshotSchedule(ShareSnapshotScheduleArgs.builder()
        .name("string")
        .recurrence("string")
        .startTime("string")
        .build())
    .terms("string")
    .build());
Copy
share_resource = azure.datashare.Share("shareResource",
    account_id="string",
    kind="string",
    description="string",
    name="string",
    snapshot_schedule={
        "name": "string",
        "recurrence": "string",
        "start_time": "string",
    },
    terms="string")
Copy
const shareResource = new azure.datashare.Share("shareResource", {
    accountId: "string",
    kind: "string",
    description: "string",
    name: "string",
    snapshotSchedule: {
        name: "string",
        recurrence: "string",
        startTime: "string",
    },
    terms: "string",
});
Copy
type: azure:datashare:Share
properties:
    accountId: string
    description: string
    kind: string
    name: string
    snapshotSchedule:
        name: string
        recurrence: string
        startTime: string
    terms: string
Copy

Share 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 Share resource accepts the following input properties:

AccountId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Data Share account in which the Data Share is created. Changing this forces a new Data Share to be created.
Kind
This property is required.
Changes to this property will trigger replacement.
string
The kind of the Data Share. Possible values are CopyBased and InPlace. Changing this forces a new Data Share to be created.
Description string
The Data Share's description.
Name Changes to this property will trigger replacement. string
The name which should be used for this Data Share. Changing this forces a new Data Share to be created.
SnapshotSchedule ShareSnapshotSchedule
A snapshot_schedule block as defined below.
Terms string
The terms of the Data Share.
AccountId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Data Share account in which the Data Share is created. Changing this forces a new Data Share to be created.
Kind
This property is required.
Changes to this property will trigger replacement.
string
The kind of the Data Share. Possible values are CopyBased and InPlace. Changing this forces a new Data Share to be created.
Description string
The Data Share's description.
Name Changes to this property will trigger replacement. string
The name which should be used for this Data Share. Changing this forces a new Data Share to be created.
SnapshotSchedule ShareSnapshotScheduleArgs
A snapshot_schedule block as defined below.
Terms string
The terms of the Data Share.
accountId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Data Share account in which the Data Share is created. Changing this forces a new Data Share to be created.
kind
This property is required.
Changes to this property will trigger replacement.
String
The kind of the Data Share. Possible values are CopyBased and InPlace. Changing this forces a new Data Share to be created.
description String
The Data Share's description.
name Changes to this property will trigger replacement. String
The name which should be used for this Data Share. Changing this forces a new Data Share to be created.
snapshotSchedule ShareSnapshotSchedule
A snapshot_schedule block as defined below.
terms String
The terms of the Data Share.
accountId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Data Share account in which the Data Share is created. Changing this forces a new Data Share to be created.
kind
This property is required.
Changes to this property will trigger replacement.
string
The kind of the Data Share. Possible values are CopyBased and InPlace. Changing this forces a new Data Share to be created.
description string
The Data Share's description.
name Changes to this property will trigger replacement. string
The name which should be used for this Data Share. Changing this forces a new Data Share to be created.
snapshotSchedule ShareSnapshotSchedule
A snapshot_schedule block as defined below.
terms string
The terms of the Data Share.
account_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the Data Share account in which the Data Share is created. Changing this forces a new Data Share to be created.
kind
This property is required.
Changes to this property will trigger replacement.
str
The kind of the Data Share. Possible values are CopyBased and InPlace. Changing this forces a new Data Share to be created.
description str
The Data Share's description.
name Changes to this property will trigger replacement. str
The name which should be used for this Data Share. Changing this forces a new Data Share to be created.
snapshot_schedule ShareSnapshotScheduleArgs
A snapshot_schedule block as defined below.
terms str
The terms of the Data Share.
accountId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Data Share account in which the Data Share is created. Changing this forces a new Data Share to be created.
kind
This property is required.
Changes to this property will trigger replacement.
String
The kind of the Data Share. Possible values are CopyBased and InPlace. Changing this forces a new Data Share to be created.
description String
The Data Share's description.
name Changes to this property will trigger replacement. String
The name which should be used for this Data Share. Changing this forces a new Data Share to be created.
snapshotSchedule Property Map
A snapshot_schedule block as defined below.
terms String
The terms of the Data Share.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing Share Resource

Get an existing Share 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?: ShareState, opts?: CustomResourceOptions): Share
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_id: Optional[str] = None,
        description: Optional[str] = None,
        kind: Optional[str] = None,
        name: Optional[str] = None,
        snapshot_schedule: Optional[ShareSnapshotScheduleArgs] = None,
        terms: Optional[str] = None) -> Share
func GetShare(ctx *Context, name string, id IDInput, state *ShareState, opts ...ResourceOption) (*Share, error)
public static Share Get(string name, Input<string> id, ShareState? state, CustomResourceOptions? opts = null)
public static Share get(String name, Output<String> id, ShareState state, CustomResourceOptions options)
resources:  _:    type: azure:datashare:Share    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
AccountId Changes to this property will trigger replacement. string
The ID of the Data Share account in which the Data Share is created. Changing this forces a new Data Share to be created.
Description string
The Data Share's description.
Kind Changes to this property will trigger replacement. string
The kind of the Data Share. Possible values are CopyBased and InPlace. Changing this forces a new Data Share to be created.
Name Changes to this property will trigger replacement. string
The name which should be used for this Data Share. Changing this forces a new Data Share to be created.
SnapshotSchedule ShareSnapshotSchedule
A snapshot_schedule block as defined below.
Terms string
The terms of the Data Share.
AccountId Changes to this property will trigger replacement. string
The ID of the Data Share account in which the Data Share is created. Changing this forces a new Data Share to be created.
Description string
The Data Share's description.
Kind Changes to this property will trigger replacement. string
The kind of the Data Share. Possible values are CopyBased and InPlace. Changing this forces a new Data Share to be created.
Name Changes to this property will trigger replacement. string
The name which should be used for this Data Share. Changing this forces a new Data Share to be created.
SnapshotSchedule ShareSnapshotScheduleArgs
A snapshot_schedule block as defined below.
Terms string
The terms of the Data Share.
accountId Changes to this property will trigger replacement. String
The ID of the Data Share account in which the Data Share is created. Changing this forces a new Data Share to be created.
description String
The Data Share's description.
kind Changes to this property will trigger replacement. String
The kind of the Data Share. Possible values are CopyBased and InPlace. Changing this forces a new Data Share to be created.
name Changes to this property will trigger replacement. String
The name which should be used for this Data Share. Changing this forces a new Data Share to be created.
snapshotSchedule ShareSnapshotSchedule
A snapshot_schedule block as defined below.
terms String
The terms of the Data Share.
accountId Changes to this property will trigger replacement. string
The ID of the Data Share account in which the Data Share is created. Changing this forces a new Data Share to be created.
description string
The Data Share's description.
kind Changes to this property will trigger replacement. string
The kind of the Data Share. Possible values are CopyBased and InPlace. Changing this forces a new Data Share to be created.
name Changes to this property will trigger replacement. string
The name which should be used for this Data Share. Changing this forces a new Data Share to be created.
snapshotSchedule ShareSnapshotSchedule
A snapshot_schedule block as defined below.
terms string
The terms of the Data Share.
account_id Changes to this property will trigger replacement. str
The ID of the Data Share account in which the Data Share is created. Changing this forces a new Data Share to be created.
description str
The Data Share's description.
kind Changes to this property will trigger replacement. str
The kind of the Data Share. Possible values are CopyBased and InPlace. Changing this forces a new Data Share to be created.
name Changes to this property will trigger replacement. str
The name which should be used for this Data Share. Changing this forces a new Data Share to be created.
snapshot_schedule ShareSnapshotScheduleArgs
A snapshot_schedule block as defined below.
terms str
The terms of the Data Share.
accountId Changes to this property will trigger replacement. String
The ID of the Data Share account in which the Data Share is created. Changing this forces a new Data Share to be created.
description String
The Data Share's description.
kind Changes to this property will trigger replacement. String
The kind of the Data Share. Possible values are CopyBased and InPlace. Changing this forces a new Data Share to be created.
name Changes to this property will trigger replacement. String
The name which should be used for this Data Share. Changing this forces a new Data Share to be created.
snapshotSchedule Property Map
A snapshot_schedule block as defined below.
terms String
The terms of the Data Share.

Supporting Types

ShareSnapshotSchedule
, ShareSnapshotScheduleArgs

Name This property is required. string
The name of the snapshot schedule.
Recurrence This property is required. string
The interval of the synchronization with the source data. Possible values are Hour and Day.
StartTime This property is required. string
The synchronization with the source data's start time.
Name This property is required. string
The name of the snapshot schedule.
Recurrence This property is required. string
The interval of the synchronization with the source data. Possible values are Hour and Day.
StartTime This property is required. string
The synchronization with the source data's start time.
name This property is required. String
The name of the snapshot schedule.
recurrence This property is required. String
The interval of the synchronization with the source data. Possible values are Hour and Day.
startTime This property is required. String
The synchronization with the source data's start time.
name This property is required. string
The name of the snapshot schedule.
recurrence This property is required. string
The interval of the synchronization with the source data. Possible values are Hour and Day.
startTime This property is required. string
The synchronization with the source data's start time.
name This property is required. str
The name of the snapshot schedule.
recurrence This property is required. str
The interval of the synchronization with the source data. Possible values are Hour and Day.
start_time This property is required. str
The synchronization with the source data's start time.
name This property is required. String
The name of the snapshot schedule.
recurrence This property is required. String
The interval of the synchronization with the source data. Possible values are Hour and Day.
startTime This property is required. String
The synchronization with the source data's start time.

Import

Data Shares can be imported using the resource id, e.g.

$ pulumi import azure:datashare/share:Share example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataShare/accounts/account1/shares/share1
Copy

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.