We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
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
})
}
Example coming soon!
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,
});
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)
Example coming soon!
Create ProtectedFileShare Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ProtectedFileShare(name: string, args: ProtectedFileShareArgs, opts?: CustomResourceOptions);@overload
def ProtectedFileShare(resource_name: str,
args: ProtectedFileShareArgs,
opts: Optional[ResourceOptions] = None)
@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)func NewProtectedFileShare(ctx *Context, name string, args ProtectedFileShareArgs, opts ...ResourceOption) (*ProtectedFileShare, error)public ProtectedFileShare(string name, ProtectedFileShareArgs args, CustomResourceOptions? opts = null)
public ProtectedFileShare(String name, ProtectedFileShareArgs args)
public ProtectedFileShare(String name, ProtectedFileShareArgs args, CustomResourceOptions options)
type: azure:backup:ProtectedFileShare
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 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.
- name String
- The unique name of the resource.
- args ProtectedFileShareArgs
- 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 protectedFileShareResource = new Azure.Backup.ProtectedFileShare("protectedFileShareResource", new()
{
BackupPolicyId = "string",
RecoveryVaultName = "string",
ResourceGroupName = "string",
SourceFileShareName = "string",
SourceStorageAccountId = "string",
});
example, err := backup.NewProtectedFileShare(ctx, "protectedFileShareResource", &backup.ProtectedFileShareArgs{
BackupPolicyId: pulumi.String("string"),
RecoveryVaultName: pulumi.String("string"),
ResourceGroupName: pulumi.String("string"),
SourceFileShareName: pulumi.String("string"),
SourceStorageAccountId: pulumi.String("string"),
})
var protectedFileShareResource = new ProtectedFileShare("protectedFileShareResource", ProtectedFileShareArgs.builder()
.backupPolicyId("string")
.recoveryVaultName("string")
.resourceGroupName("string")
.sourceFileShareName("string")
.sourceStorageAccountId("string")
.build());
protected_file_share_resource = azure.backup.ProtectedFileShare("protectedFileShareResource",
backup_policy_id="string",
recovery_vault_name="string",
resource_group_name="string",
source_file_share_name="string",
source_storage_account_id="string")
const protectedFileShareResource = new azure.backup.ProtectedFileShare("protectedFileShareResource", {
backupPolicyId: "string",
recoveryVaultName: "string",
resourceGroupName: "string",
sourceFileShareName: "string",
sourceStorageAccountId: "string",
});
type: azure:backup:ProtectedFileShare
properties:
backupPolicyId: string
recoveryVaultName: string
resourceGroupName: string
sourceFileShareName: string
sourceStorageAccountId: string
ProtectedFileShare 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 ProtectedFileShare resource accepts the following input properties:
- Backup
Policy stringId - 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 stringName - Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- Resource
Group stringName - 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.
- string
- Specifies the name of the file share to backup. Changing this forces a new resource to be created.
- Source
Storage stringAccount Id - Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.
- Backup
Policy stringId - 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 stringName - Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- Resource
Group stringName - 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.
- string
- Specifies the name of the file share to backup. Changing this forces a new resource to be created.
- Source
Storage stringAccount Id - Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.
- backup
Policy StringId - 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 StringName - Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- resource
Group StringName - 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.
- String
- Specifies the name of the file share to backup. Changing this forces a new resource to be created.
- source
Storage StringAccount Id - Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.
- backup
Policy stringId - 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 stringName - Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- resource
Group stringName - 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.
- string
- Specifies the name of the file share to backup. Changing this forces a new resource to be created.
- source
Storage stringAccount Id - Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.
- backup_
policy_ strid - 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_ strname - Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- resource_
group_ strname - 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.
- str
- Specifies the name of the file share to backup. Changing this forces a new resource to be created.
- source_
storage_ straccount_ id - Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.
- backup
Policy StringId - 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 StringName - Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- resource
Group StringName - 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.
- String
- Specifies the name of the file share to backup. Changing this forces a new resource to be created.
- source
Storage StringAccount Id - 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 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 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) -> ProtectedFileSharefunc 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)public static ProtectedFileShare get(String name, Output<String> id, ProtectedFileShareState state, CustomResourceOptions options)resources: _: type: azure:backup:ProtectedFileShare 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.
- Backup
Policy stringId - 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 stringName - Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- Resource
Group stringName - 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.
- string
- Specifies the name of the file share to backup. Changing this forces a new resource to be created.
- Source
Storage stringAccount Id - Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.
- Backup
Policy stringId - 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 stringName - Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- Resource
Group stringName - 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.
- string
- Specifies the name of the file share to backup. Changing this forces a new resource to be created.
- Source
Storage stringAccount Id - Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.
- backup
Policy StringId - 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 StringName - Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- resource
Group StringName - 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.
- String
- Specifies the name of the file share to backup. Changing this forces a new resource to be created.
- source
Storage StringAccount Id - Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.
- backup
Policy stringId - 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 stringName - Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- resource
Group stringName - 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.
- string
- Specifies the name of the file share to backup. Changing this forces a new resource to be created.
- source
Storage stringAccount Id - Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.
- backup_
policy_ strid - 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_ strname - Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- resource_
group_ strname - 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.
- str
- Specifies the name of the file share to backup. Changing this forces a new resource to be created.
- source_
storage_ straccount_ id - Specifies the ID of the storage account of the file share to backup. Changing this forces a new resource to be created.
- backup
Policy StringId - 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 StringName - Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
- resource
Group StringName - 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.
- String
- Specifies the name of the file share to backup. Changing this forces a new resource to be created.
- source
Storage StringAccount Id - 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.
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
azurermTerraform Provider.
We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
