Skip to content

Storage Account#

Template checks

Create or update a Storage Account.

Parameters#

Parameter name Required Description
storageAccountName Yes Required. The name of the Storage Account.
location No Optional. The Azure region to deploy to.
sku No Optional. Crease the Storage Account as LRS or GRS.
tags No Optional. Tags to apply to the resource.
containers No Optional. An array of storage containers to create on the storage account.
lifecycleRules No Optional. An array of lifecycle management policies for the storage account.
softDeleteDays No Optional. The number of days to retain deleted blobs. When set to 0, soft delete is disabled.

storageAccountName#

Parameter Setting

Required. The name of the Storage Account.

location#

Parameter Setting

Optional. The Azure region to deploy to.

  • Default value: [resourceGroup().location]

sku#

Parameter Setting

Optional. Crease the Storage Account as LRS or GRS.

  • Default value: Standard_LRS

  • Allowed values: Standard_LRS, Standard_GRS

tags#

Parameter Setting

Optional. Tags to apply to the resource.

containers#

Parameter Setting

Optional. An array of storage containers to create on the storage account.

lifecycleRules#

Parameter Setting

Optional. An array of lifecycle management policies for the storage account.

softDeleteDays#

Parameter Setting

Optional. The number of days to retain deleted blobs. When set to 0, soft delete is disabled.

  • Default value: 0

Outputs#

Name Type Description
resourceId string A unique resource identifier for the storage account.

Snippets#

Parameter file#

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "metadata": {
        "template": "templates/storage/v1/template.json"
    },
    "parameters": {
        "storageAccountName": {
            "value": "<name>"
        },
        "sku": {
            "value": "Standard_LRS"
        },
        "tags": {
            "value": {
                "service": "<service_name>",
                "env": "prod"
            }
        },
        "containers": {
            "value": []
        },
        "lifecycleRules": {
            "value": []
        },
        "softDeleteDays": {
            "value": 7
        }
    }
}

Command line#

PowerShell#

New-AzResourceGroupDeployment -Name <deployment-name> -ResourceGroupName <resource-group-name> -TemplateFile <path-to-template> -TemplateParameterFile <path-to-templateparameter>

Azure CLI#

az group deployment create --name <deployment-name> --resource-group <resource-group-name> --template-file <path-to-template> --parameters @<path-to-templateparameterfile>

Last update: 2021-10-22