We recommend using Azure Native.
azure.backup.ContainerStorageAccount
Explore with Pulumi AI
Manages registration of a storage account with Azure Backup. Storage accounts must be registered with an Azure Recovery Vault in order to backup file shares within the storage account. Registering a storage account with a vault creates what is known as a protection container within Azure Recovery Services. Once the container is created, Azure file shares within the storage account can be backed up using the azure.backup.ProtectedFileShare resource.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
    name: "tfex-network-mapping-primary",
    location: "West Europe",
});
const vault = new azure.recoveryservices.Vault("vault", {
    name: "example-recovery-vault",
    location: example.location,
    resourceGroupName: example.name,
    sku: "Standard",
});
const sa = new azure.storage.Account("sa", {
    name: "examplesa",
    location: example.location,
    resourceGroupName: example.name,
    accountTier: "Standard",
    accountReplicationType: "LRS",
});
const container = new azure.backup.ContainerStorageAccount("container", {
    resourceGroupName: example.name,
    recoveryVaultName: vault.name,
    storageAccountId: sa.id,
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
    name="tfex-network-mapping-primary",
    location="West Europe")
vault = azure.recoveryservices.Vault("vault",
    name="example-recovery-vault",
    location=example.location,
    resource_group_name=example.name,
    sku="Standard")
sa = azure.storage.Account("sa",
    name="examplesa",
    location=example.location,
    resource_group_name=example.name,
    account_tier="Standard",
    account_replication_type="LRS")
container = azure.backup.ContainerStorageAccount("container",
    resource_group_name=example.name,
    recovery_vault_name=vault.name,
    storage_account_id=sa.id)
package main
import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/backup"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/recoveryservices"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/storage"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("tfex-network-mapping-primary"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		vault, err := recoveryservices.NewVault(ctx, "vault", &recoveryservices.VaultArgs{
			Name:              pulumi.String("example-recovery-vault"),
			Location:          example.Location,
			ResourceGroupName: example.Name,
			Sku:               pulumi.String("Standard"),
		})
		if err != nil {
			return err
		}
		sa, err := storage.NewAccount(ctx, "sa", &storage.AccountArgs{
			Name:                   pulumi.String("examplesa"),
			Location:               example.Location,
			ResourceGroupName:      example.Name,
			AccountTier:            pulumi.String("Standard"),
			AccountReplicationType: pulumi.String("LRS"),
		})
		if err != nil {
			return err
		}
		_, err = backup.NewContainerStorageAccount(ctx, "container", &backup.ContainerStorageAccountArgs{
			ResourceGroupName: example.Name,
			RecoveryVaultName: vault.Name,
			StorageAccountId:  sa.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "tfex-network-mapping-primary",
        Location = "West Europe",
    });
    var vault = new Azure.RecoveryServices.Vault("vault", new()
    {
        Name = "example-recovery-vault",
        Location = example.Location,
        ResourceGroupName = example.Name,
        Sku = "Standard",
    });
    var sa = new Azure.Storage.Account("sa", new()
    {
        Name = "examplesa",
        Location = example.Location,
        ResourceGroupName = example.Name,
        AccountTier = "Standard",
        AccountReplicationType = "LRS",
    });
    var container = new Azure.Backup.ContainerStorageAccount("container", new()
    {
        ResourceGroupName = example.Name,
        RecoveryVaultName = vault.Name,
        StorageAccountId = sa.Id,
    });
});
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.recoveryservices.Vault;
import com.pulumi.azure.recoveryservices.VaultArgs;
import com.pulumi.azure.storage.Account;
import com.pulumi.azure.storage.AccountArgs;
import com.pulumi.azure.backup.ContainerStorageAccount;
import com.pulumi.azure.backup.ContainerStorageAccountArgs;
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("tfex-network-mapping-primary")
            .location("West Europe")
            .build());
        var vault = new Vault("vault", VaultArgs.builder()
            .name("example-recovery-vault")
            .location(example.location())
            .resourceGroupName(example.name())
            .sku("Standard")
            .build());
        var sa = new Account("sa", AccountArgs.builder()
            .name("examplesa")
            .location(example.location())
            .resourceGroupName(example.name())
            .accountTier("Standard")
            .accountReplicationType("LRS")
            .build());
        var container = new ContainerStorageAccount("container", ContainerStorageAccountArgs.builder()
            .resourceGroupName(example.name())
            .recoveryVaultName(vault.name())
            .storageAccountId(sa.id())
            .build());
    }
}
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: tfex-network-mapping-primary
      location: West Europe
  vault:
    type: azure:recoveryservices:Vault
    properties:
      name: example-recovery-vault
      location: ${example.location}
      resourceGroupName: ${example.name}
      sku: Standard
  sa:
    type: azure:storage:Account
    properties:
      name: examplesa
      location: ${example.location}
      resourceGroupName: ${example.name}
      accountTier: Standard
      accountReplicationType: LRS
  container:
    type: azure:backup:ContainerStorageAccount
    properties:
      resourceGroupName: ${example.name}
      recoveryVaultName: ${vault.name}
      storageAccountId: ${sa.id}
Create ContainerStorageAccount Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ContainerStorageAccount(name: string, args: ContainerStorageAccountArgs, opts?: CustomResourceOptions);@overload
def ContainerStorageAccount(resource_name: str,
                            args: ContainerStorageAccountArgs,
                            opts: Optional[ResourceOptions] = None)
@overload
def ContainerStorageAccount(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            recovery_vault_name: Optional[str] = None,
                            resource_group_name: Optional[str] = None,
                            storage_account_id: Optional[str] = None)func NewContainerStorageAccount(ctx *Context, name string, args ContainerStorageAccountArgs, opts ...ResourceOption) (*ContainerStorageAccount, error)public ContainerStorageAccount(string name, ContainerStorageAccountArgs args, CustomResourceOptions? opts = null)
public ContainerStorageAccount(String name, ContainerStorageAccountArgs args)
public ContainerStorageAccount(String name, ContainerStorageAccountArgs args, CustomResourceOptions options)
type: azure:backup:ContainerStorageAccount
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 ContainerStorageAccountArgs
- 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 ContainerStorageAccountArgs
- 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 ContainerStorageAccountArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ContainerStorageAccountArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ContainerStorageAccountArgs
- 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 containerStorageAccountResource = new Azure.Backup.ContainerStorageAccount("containerStorageAccountResource", new()
{
    RecoveryVaultName = "string",
    ResourceGroupName = "string",
    StorageAccountId = "string",
});
example, err := backup.NewContainerStorageAccount(ctx, "containerStorageAccountResource", &backup.ContainerStorageAccountArgs{
	RecoveryVaultName: pulumi.String("string"),
	ResourceGroupName: pulumi.String("string"),
	StorageAccountId:  pulumi.String("string"),
})
var containerStorageAccountResource = new ContainerStorageAccount("containerStorageAccountResource", ContainerStorageAccountArgs.builder()
    .recoveryVaultName("string")
    .resourceGroupName("string")
    .storageAccountId("string")
    .build());
container_storage_account_resource = azure.backup.ContainerStorageAccount("containerStorageAccountResource",
    recovery_vault_name="string",
    resource_group_name="string",
    storage_account_id="string")
const containerStorageAccountResource = new azure.backup.ContainerStorageAccount("containerStorageAccountResource", {
    recoveryVaultName: "string",
    resourceGroupName: "string",
    storageAccountId: "string",
});
type: azure:backup:ContainerStorageAccount
properties:
    recoveryVaultName: string
    resourceGroupName: string
    storageAccountId: string
ContainerStorageAccount 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 ContainerStorageAccount resource accepts the following input properties:
- RecoveryVault stringName 
- The name of the vault where the storage account will be registered. Changing this forces a new resource to be created.
- ResourceGroup stringName 
- Name of the resource group where the vault is located. Changing this forces a new resource to be created.
- StorageAccount stringId 
- The ID of the Storage Account to be registered Changing this forces a new resource to be created. - NOTE Azure Backup places a Resource Lock on the storage account that will cause deletion to fail until the account is unregistered from Azure Backup 
- RecoveryVault stringName 
- The name of the vault where the storage account will be registered. Changing this forces a new resource to be created.
- ResourceGroup stringName 
- Name of the resource group where the vault is located. Changing this forces a new resource to be created.
- StorageAccount stringId 
- The ID of the Storage Account to be registered Changing this forces a new resource to be created. - NOTE Azure Backup places a Resource Lock on the storage account that will cause deletion to fail until the account is unregistered from Azure Backup 
- recoveryVault StringName 
- The name of the vault where the storage account will be registered. Changing this forces a new resource to be created.
- resourceGroup StringName 
- Name of the resource group where the vault is located. Changing this forces a new resource to be created.
- storageAccount StringId 
- The ID of the Storage Account to be registered Changing this forces a new resource to be created. - NOTE Azure Backup places a Resource Lock on the storage account that will cause deletion to fail until the account is unregistered from Azure Backup 
- recoveryVault stringName 
- The name of the vault where the storage account will be registered. Changing this forces a new resource to be created.
- resourceGroup stringName 
- Name of the resource group where the vault is located. Changing this forces a new resource to be created.
- storageAccount stringId 
- The ID of the Storage Account to be registered Changing this forces a new resource to be created. - NOTE Azure Backup places a Resource Lock on the storage account that will cause deletion to fail until the account is unregistered from Azure Backup 
- recovery_vault_ strname 
- The name of the vault where the storage account will be registered. Changing this forces a new resource to be created.
- resource_group_ strname 
- Name of the resource group where the vault is located. Changing this forces a new resource to be created.
- storage_account_ strid 
- The ID of the Storage Account to be registered Changing this forces a new resource to be created. - NOTE Azure Backup places a Resource Lock on the storage account that will cause deletion to fail until the account is unregistered from Azure Backup 
- recoveryVault StringName 
- The name of the vault where the storage account will be registered. Changing this forces a new resource to be created.
- resourceGroup StringName 
- Name of the resource group where the vault is located. Changing this forces a new resource to be created.
- storageAccount StringId 
- The ID of the Storage Account to be registered Changing this forces a new resource to be created. - NOTE Azure Backup places a Resource Lock on the storage account that will cause deletion to fail until the account is unregistered from Azure Backup 
Outputs
All input properties are implicitly available as output properties. Additionally, the ContainerStorageAccount 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 ContainerStorageAccount Resource
Get an existing ContainerStorageAccount 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?: ContainerStorageAccountState, opts?: CustomResourceOptions): ContainerStorageAccount@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        recovery_vault_name: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        storage_account_id: Optional[str] = None) -> ContainerStorageAccountfunc GetContainerStorageAccount(ctx *Context, name string, id IDInput, state *ContainerStorageAccountState, opts ...ResourceOption) (*ContainerStorageAccount, error)public static ContainerStorageAccount Get(string name, Input<string> id, ContainerStorageAccountState? state, CustomResourceOptions? opts = null)public static ContainerStorageAccount get(String name, Output<String> id, ContainerStorageAccountState state, CustomResourceOptions options)resources:  _:    type: azure:backup:ContainerStorageAccount    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.
- RecoveryVault stringName 
- The name of the vault where the storage account will be registered. Changing this forces a new resource to be created.
- ResourceGroup stringName 
- Name of the resource group where the vault is located. Changing this forces a new resource to be created.
- StorageAccount stringId 
- The ID of the Storage Account to be registered Changing this forces a new resource to be created. - NOTE Azure Backup places a Resource Lock on the storage account that will cause deletion to fail until the account is unregistered from Azure Backup 
- RecoveryVault stringName 
- The name of the vault where the storage account will be registered. Changing this forces a new resource to be created.
- ResourceGroup stringName 
- Name of the resource group where the vault is located. Changing this forces a new resource to be created.
- StorageAccount stringId 
- The ID of the Storage Account to be registered Changing this forces a new resource to be created. - NOTE Azure Backup places a Resource Lock on the storage account that will cause deletion to fail until the account is unregistered from Azure Backup 
- recoveryVault StringName 
- The name of the vault where the storage account will be registered. Changing this forces a new resource to be created.
- resourceGroup StringName 
- Name of the resource group where the vault is located. Changing this forces a new resource to be created.
- storageAccount StringId 
- The ID of the Storage Account to be registered Changing this forces a new resource to be created. - NOTE Azure Backup places a Resource Lock on the storage account that will cause deletion to fail until the account is unregistered from Azure Backup 
- recoveryVault stringName 
- The name of the vault where the storage account will be registered. Changing this forces a new resource to be created.
- resourceGroup stringName 
- Name of the resource group where the vault is located. Changing this forces a new resource to be created.
- storageAccount stringId 
- The ID of the Storage Account to be registered Changing this forces a new resource to be created. - NOTE Azure Backup places a Resource Lock on the storage account that will cause deletion to fail until the account is unregistered from Azure Backup 
- recovery_vault_ strname 
- The name of the vault where the storage account will be registered. Changing this forces a new resource to be created.
- resource_group_ strname 
- Name of the resource group where the vault is located. Changing this forces a new resource to be created.
- storage_account_ strid 
- The ID of the Storage Account to be registered Changing this forces a new resource to be created. - NOTE Azure Backup places a Resource Lock on the storage account that will cause deletion to fail until the account is unregistered from Azure Backup 
- recoveryVault StringName 
- The name of the vault where the storage account will be registered. Changing this forces a new resource to be created.
- resourceGroup StringName 
- Name of the resource group where the vault is located. Changing this forces a new resource to be created.
- storageAccount StringId 
- The ID of the Storage Account to be registered Changing this forces a new resource to be created. - NOTE Azure Backup places a Resource Lock on the storage account that will cause deletion to fail until the account is unregistered from Azure Backup 
Import
Backup Storage Account Containers can be imported using the resource id, e.g.
$ pulumi import azure:backup/containerStorageAccount:ContainerStorageAccount mycontainer "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-group-name/providers/Microsoft.RecoveryServices/vaults/recovery-vault-name/backupFabrics/Azure/protectionContainers/StorageContainer;storage;storage-rg-name;storage-account"
Note the ID requires quoting as there are semicolons
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.