ProtectedFileShare

Manages an Azure Backup Protected File Share to enable backups for file shares within an Azure Storage Account

Example Usage

using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
    public MyStack()
    {
        var rg = new Azure.Core.ResourceGroup("rg", new Azure.Core.ResourceGroupArgs
        {
            Location = "West Europe",
        });
        var vault = new Azure.RecoveryServices.Vault("vault", new Azure.RecoveryServices.VaultArgs
        {
            Location = rg.Location,
            ResourceGroupName = rg.Name,
            Sku = "Standard",
        });
        var sa = new Azure.Storage.Account("sa", new Azure.Storage.AccountArgs
        {
            Location = rg.Location,
            ResourceGroupName = rg.Name,
            AccountTier = "Standard",
            AccountReplicationType = "LRS",
        });
        var exampleShare = new Azure.Storage.Share("exampleShare", new Azure.Storage.ShareArgs
        {
            StorageAccountName = sa.Name,
        });
        var protection_container = new Azure.Backup.ContainerStorageAccount("protection-container", new Azure.Backup.ContainerStorageAccountArgs
        {
            ResourceGroupName = rg.Name,
            RecoveryVaultName = vault.Name,
            StorageAccountId = sa.Id,
        });
        var examplePolicyFileShare = new Azure.Backup.PolicyFileShare("examplePolicyFileShare", new Azure.Backup.PolicyFileShareArgs
        {
            ResourceGroupName = rg.Name,
            RecoveryVaultName = vault.Name,
            Backup = new Azure.Backup.Inputs.PolicyFileShareBackupArgs
            {
                Frequency = "Daily",
                Time = "23:00",
            },
            RetentionDaily = new Azure.Backup.Inputs.PolicyFileShareRetentionDailyArgs
            {
                Count = 10,
            },
        });
        var share1 = new Azure.Backup.ProtectedFileShare("share1", new Azure.Backup.ProtectedFileShareArgs
        {
            ResourceGroupName = rg.Name,
            RecoveryVaultName = vault.Name,
            SourceStorageAccountId = protection_container.StorageAccountId,
            SourceFileShareName = exampleShare.Name,
            BackupPolicyId = examplePolicyFileShare.Id,
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/backup"
	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/recoveryservices"
	"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 {
		rg, err := core.NewResourceGroup(ctx, "rg", &core.ResourceGroupArgs{
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		vault, err := recoveryservices.NewVault(ctx, "vault", &recoveryservices.VaultArgs{
			Location:          rg.Location,
			ResourceGroupName: rg.Name,
			Sku:               pulumi.String("Standard"),
		})
		if err != nil {
			return err
		}
		sa, err := storage.NewAccount(ctx, "sa", &storage.AccountArgs{
			Location:               rg.Location,
			ResourceGroupName:      rg.Name,
			AccountTier:            pulumi.String("Standard"),
			AccountReplicationType: pulumi.String("LRS"),
		})
		if err != nil {
			return err
		}
		exampleShare, err := storage.NewShare(ctx, "exampleShare", &storage.ShareArgs{
			StorageAccountName: sa.Name,
		})
		if err != nil {
			return err
		}
		_, err = backup.NewContainerStorageAccount(ctx, "protection_container", &backup.ContainerStorageAccountArgs{
			ResourceGroupName: rg.Name,
			RecoveryVaultName: vault.Name,
			StorageAccountId:  sa.ID(),
		})
		if err != nil {
			return err
		}
		examplePolicyFileShare, err := backup.NewPolicyFileShare(ctx, "examplePolicyFileShare", &backup.PolicyFileShareArgs{
			ResourceGroupName: rg.Name,
			RecoveryVaultName: vault.Name,
			Backup: &backup.PolicyFileShareBackupArgs{
				Frequency: pulumi.String("Daily"),
				Time:      pulumi.String("23:00"),
			},
			RetentionDaily: &backup.PolicyFileShareRetentionDailyArgs{
				Count: pulumi.Int(10),
			},
		})
		if err != nil {
			return err
		}
		_, err = backup.NewProtectedFileShare(ctx, "share1", &backup.ProtectedFileShareArgs{
			ResourceGroupName:      rg.Name,
			RecoveryVaultName:      vault.Name,
			SourceStorageAccountId: protection_container.StorageAccountId,
			SourceFileShareName:    exampleShare.Name,
			BackupPolicyId:         examplePolicyFileShare.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_azure as azure

rg = azure.core.ResourceGroup("rg", location="West Europe")
vault = azure.recoveryservices.Vault("vault",
    location=rg.location,
    resource_group_name=rg.name,
    sku="Standard")
sa = azure.storage.Account("sa",
    location=rg.location,
    resource_group_name=rg.name,
    account_tier="Standard",
    account_replication_type="LRS")
example_share = azure.storage.Share("exampleShare", storage_account_name=sa.name)
protection_container = azure.backup.ContainerStorageAccount("protection-container",
    resource_group_name=rg.name,
    recovery_vault_name=vault.name,
    storage_account_id=sa.id)
example_policy_file_share = azure.backup.PolicyFileShare("examplePolicyFileShare",
    resource_group_name=rg.name,
    recovery_vault_name=vault.name,
    backup=azure.backup.PolicyFileShareBackupArgs(
        frequency="Daily",
        time="23:00",
    ),
    retention_daily=azure.backup.PolicyFileShareRetentionDailyArgs(
        count=10,
    ))
share1 = azure.backup.ProtectedFileShare("share1",
    resource_group_name=rg.name,
    recovery_vault_name=vault.name,
    source_storage_account_id=protection_container.storage_account_id,
    source_file_share_name=example_share.name,
    backup_policy_id=example_policy_file_share.id)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const rg = new azure.core.ResourceGroup("rg", {location: "West Europe"});
const vault = new azure.recoveryservices.Vault("vault", {
    location: rg.location,
    resourceGroupName: rg.name,
    sku: "Standard",
});
const sa = new azure.storage.Account("sa", {
    location: rg.location,
    resourceGroupName: rg.name,
    accountTier: "Standard",
    accountReplicationType: "LRS",
});
const exampleShare = new azure.storage.Share("exampleShare", {storageAccountName: sa.name});
const protection_container = new azure.backup.ContainerStorageAccount("protection-container", {
    resourceGroupName: rg.name,
    recoveryVaultName: vault.name,
    storageAccountId: sa.id,
});
const examplePolicyFileShare = new azure.backup.PolicyFileShare("examplePolicyFileShare", {
    resourceGroupName: rg.name,
    recoveryVaultName: vault.name,
    backup: {
        frequency: "Daily",
        time: "23:00",
    },
    retentionDaily: {
        count: 10,
    },
});
const share1 = new azure.backup.ProtectedFileShare("share1", {
    resourceGroupName: rg.name,
    recoveryVaultName: vault.name,
    sourceStorageAccountId: protection_container.storageAccountId,
    sourceFileShareName: exampleShare.name,
    backupPolicyId: examplePolicyFileShare.id,
});

Create a ProtectedFileShare Resource

new ProtectedFileShare(name: string, args: ProtectedFileShareArgs, opts?: CustomResourceOptions);
@overload
def ProtectedFileShare(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       backup_policy_id: Optional[str] = None,
                       recovery_vault_name: Optional[str] = None,
                       resource_group_name: Optional[str] = None,
                       source_file_share_name: Optional[str] = None,
                       source_storage_account_id: Optional[str] = None)
@overload
def ProtectedFileShare(resource_name: str,
                       args: ProtectedFileShareArgs,
                       opts: Optional[ResourceOptions] = None)
func NewProtectedFileShare(ctx *Context, name string, args ProtectedFileShareArgs, opts ...ResourceOption) (*ProtectedFileShare, error)
public ProtectedFileShare(string name, ProtectedFileShareArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args ProtectedFileShareArgs
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 ProtectedFileShareArgs
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 ProtectedFileShareArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ProtectedFileShareArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

ProtectedFileShare Resource Properties

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

Inputs

The ProtectedFileShare resource accepts the following input properties:

BackupPolicyId string
Specifies the ID of the backup policy to use. The policy must be an Azure File Share backup policy. Other types are not supported.
RecoveryVaultName string
Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
ResourceGroupName string
The name of the resource group in which to create the Azure Backup Protected File Share. Changing this forces a new resource to be created.
SourceFileShareName string
Specifies the name of the file share to backup. Changing this forces a new resource to be created.
SourceStorageAccountId string
Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.
BackupPolicyId string
Specifies the ID of the backup policy to use. The policy must be an Azure File Share backup policy. Other types are not supported.
RecoveryVaultName string
Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
ResourceGroupName string
The name of the resource group in which to create the Azure Backup Protected File Share. Changing this forces a new resource to be created.
SourceFileShareName string
Specifies the name of the file share to backup. Changing this forces a new resource to be created.
SourceStorageAccountId string
Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.
backupPolicyId string
Specifies the ID of the backup policy to use. The policy must be an Azure File Share backup policy. Other types are not supported.
recoveryVaultName string
Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
resourceGroupName string
The name of the resource group in which to create the Azure Backup Protected File Share. Changing this forces a new resource to be created.
sourceFileShareName string
Specifies the name of the file share to backup. Changing this forces a new resource to be created.
sourceStorageAccountId string
Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.
backup_policy_id str
Specifies the ID of the backup policy to use. The policy must be an Azure File Share backup policy. Other types are not supported.
recovery_vault_name str
Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
resource_group_name str
The name of the resource group in which to create the Azure Backup Protected File Share. Changing this forces a new resource to be created.
source_file_share_name str
Specifies the name of the file share to backup. Changing this forces a new resource to be created.
source_storage_account_id str
Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the ProtectedFileShare 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing ProtectedFileShare Resource

Get an existing ProtectedFileShare 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?: ProtectedFileShareState, opts?: CustomResourceOptions): ProtectedFileShare
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        backup_policy_id: Optional[str] = None,
        recovery_vault_name: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        source_file_share_name: Optional[str] = None,
        source_storage_account_id: Optional[str] = None) -> ProtectedFileShare
func GetProtectedFileShare(ctx *Context, name string, id IDInput, state *ProtectedFileShareState, opts ...ResourceOption) (*ProtectedFileShare, error)
public static ProtectedFileShare Get(string name, Input<string> id, ProtectedFileShareState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

BackupPolicyId string
Specifies the ID of the backup policy to use. The policy must be an Azure File Share backup policy. Other types are not supported.
RecoveryVaultName string
Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
ResourceGroupName string
The name of the resource group in which to create the Azure Backup Protected File Share. Changing this forces a new resource to be created.
SourceFileShareName string
Specifies the name of the file share to backup. Changing this forces a new resource to be created.
SourceStorageAccountId string
Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.
BackupPolicyId string
Specifies the ID of the backup policy to use. The policy must be an Azure File Share backup policy. Other types are not supported.
RecoveryVaultName string
Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
ResourceGroupName string
The name of the resource group in which to create the Azure Backup Protected File Share. Changing this forces a new resource to be created.
SourceFileShareName string
Specifies the name of the file share to backup. Changing this forces a new resource to be created.
SourceStorageAccountId string
Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.
backupPolicyId string
Specifies the ID of the backup policy to use. The policy must be an Azure File Share backup policy. Other types are not supported.
recoveryVaultName string
Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
resourceGroupName string
The name of the resource group in which to create the Azure Backup Protected File Share. Changing this forces a new resource to be created.
sourceFileShareName string
Specifies the name of the file share to backup. Changing this forces a new resource to be created.
sourceStorageAccountId string
Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.
backup_policy_id str
Specifies the ID of the backup policy to use. The policy must be an Azure File Share backup policy. Other types are not supported.
recovery_vault_name str
Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
resource_group_name str
The name of the resource group in which to create the Azure Backup Protected File Share. Changing this forces a new resource to be created.
source_file_share_name str
Specifies the name of the file share to backup. Changing this forces a new resource to be created.
source_storage_account_id str
Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.

Import

Azure Backup Protected File Shares can be imported using the resource id, e.g.

 $ pulumi import azure:backup/protectedFileShare:ProtectedFileShare item1 "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/example-recovery-vault/backupFabrics/Azure/protectionContainers/StorageContainer;storage;group2;example-storage-account/protectedItems/AzureFileShare;3f6e3108a45793581bcbd1c61c87a3b2ceeb4ff4bc02a95ce9d1022b23722935"

-> NOTE The ID requires quoting as there are semicolons. This user unfriendly ID can be found in the Deployments of the used resourcegroup, look for an Deployment which starts with ConfigureAFSProtection-, click then Go to resource.

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.