Azure Classic

Pulumi Official
Package maintained by Pulumi
v5.15.0 published on Wednesday, Aug 17, 2022 by Pulumi

ContainerStorageAccount

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

using System.Collections.Generic;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Location = "West Europe",
    });

    var vault = new Azure.RecoveryServices.Vault("vault", new()
    {
        Location = example.Location,
        ResourceGroupName = example.Name,
        Sku = "Standard",
    });

    var sa = new Azure.Storage.Account("sa", new()
    {
        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 main

import (
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/backup"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/recoveryservices"
	"github.com/pulumi/pulumi-azure/sdk/v5/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{
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		vault, err := recoveryservices.NewVault(ctx, "vault", &recoveryservices.VaultArgs{
			Location:          example.Location,
			ResourceGroupName: example.Name,
			Sku:               pulumi.String("Standard"),
		})
		if err != nil {
			return err
		}
		sa, err := storage.NewAccount(ctx, "sa", &storage.AccountArgs{
			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
	})
}
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()        
            .location("West Europe")
            .build());

        var vault = new Vault("vault", VaultArgs.builder()        
            .location(example.location())
            .resourceGroupName(example.name())
            .sku("Standard")
            .build());

        var sa = new Account("sa", AccountArgs.builder()        
            .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());

    }
}
import pulumi
import pulumi_azure as azure

example = azure.core.ResourceGroup("example", location="West Europe")
vault = azure.recoveryservices.Vault("vault",
    location=example.location,
    resource_group_name=example.name,
    sku="Standard")
sa = azure.storage.Account("sa",
    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)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = new azure.core.ResourceGroup("example", {location: "West Europe"});
const vault = new azure.recoveryservices.Vault("vault", {
    location: example.location,
    resourceGroupName: example.name,
    sku: "Standard",
});
const sa = new azure.storage.Account("sa", {
    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,
});
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      location: West Europe
  vault:
    type: azure:recoveryservices:Vault
    properties:
      location: ${example.location}
      resourceGroupName: ${example.name}
      sku: Standard
  sa:
    type: azure:storage:Account
    properties:
      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 a ContainerStorageAccount Resource

new ContainerStorageAccount(name: string, args: ContainerStorageAccountArgs, opts?: CustomResourceOptions);
@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)
@overload
def ContainerStorageAccount(resource_name: str,
                            args: ContainerStorageAccountArgs,
                            opts: Optional[ResourceOptions] = 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.

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.

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

The ContainerStorageAccount resource accepts the following input properties:

RecoveryVaultName string

The name of the vault where the storage account will be registered.

ResourceGroupName string

Name of the resource group where the vault is located.

StorageAccountId string

The ID of the Storage Account to be registered

RecoveryVaultName string

The name of the vault where the storage account will be registered.

ResourceGroupName string

Name of the resource group where the vault is located.

StorageAccountId string

The ID of the Storage Account to be registered

recoveryVaultName String

The name of the vault where the storage account will be registered.

resourceGroupName String

Name of the resource group where the vault is located.

storageAccountId String

The ID of the Storage Account to be registered

recoveryVaultName string

The name of the vault where the storage account will be registered.

resourceGroupName string

Name of the resource group where the vault is located.

storageAccountId string

The ID of the Storage Account to be registered

recovery_vault_name str

The name of the vault where the storage account will be registered.

resource_group_name str

Name of the resource group where the vault is located.

storage_account_id str

The ID of the Storage Account to be registered

recoveryVaultName String

The name of the vault where the storage account will be registered.

resourceGroupName String

Name of the resource group where the vault is located.

storageAccountId String

The ID of the Storage Account to be registered

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 an 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) -> ContainerStorageAccount
func 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)
Resource lookup is not supported in YAML
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:
RecoveryVaultName string

The name of the vault where the storage account will be registered.

ResourceGroupName string

Name of the resource group where the vault is located.

StorageAccountId string

The ID of the Storage Account to be registered

RecoveryVaultName string

The name of the vault where the storage account will be registered.

ResourceGroupName string

Name of the resource group where the vault is located.

StorageAccountId string

The ID of the Storage Account to be registered

recoveryVaultName String

The name of the vault where the storage account will be registered.

resourceGroupName String

Name of the resource group where the vault is located.

storageAccountId String

The ID of the Storage Account to be registered

recoveryVaultName string

The name of the vault where the storage account will be registered.

resourceGroupName string

Name of the resource group where the vault is located.

storageAccountId string

The ID of the Storage Account to be registered

recovery_vault_name str

The name of the vault where the storage account will be registered.

resource_group_name str

Name of the resource group where the vault is located.

storage_account_id str

The ID of the Storage Account to be registered

recoveryVaultName String

The name of the vault where the storage account will be registered.

resourceGroupName String

Name of the resource group where the vault is located.

storageAccountId String

The ID of the Storage Account to be registered

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

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.