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.
suffixLength No Optional. Determine how many additional characters are added to the storage account name as a suffix.
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.
blobSoftDeleteDays No Optional. The number of days to retain deleted blobs. When set to 0, soft delete is disabled.
containerSoftDeleteDays No Optional. The number of days to retain deleted containers. When set to 0, soft delete is disabled.
shares No Optional. An array of file shares to create on the storage account.
useLargeFileShares No Optional. Determines if large file shares are enabled. This can not be disabled once enabled.
shareSoftDeleteDays No Optional. The number of days to retain deleted shares. When set to 0, soft delete is disabled.
allowBlobPublicAccess No Optional. Determines if any containers can be configured with the anonymous access types of blob or container.
keyVaultPrincipalId No Optional. Set to the objectId of Azure Key Vault to delegated permission for use with Key Managed Storage Accounts.
tags No Optional. Tags to apply to the resource.

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

suffixLength#

Parameter Setting

Optional. Determine how many additional characters are added to the storage account name as a suffix.

  • Default value: 0

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.

blobSoftDeleteDays#

Parameter Setting

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

  • Default value: 0

containerSoftDeleteDays#

Parameter Setting

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

  • Default value: 0

shares#

Parameter Setting

Optional. An array of file shares to create on the storage account.

useLargeFileShares#

Parameter Setting

Optional. Determines if large file shares are enabled. This can not be disabled once enabled.

  • Default value: False

shareSoftDeleteDays#

Parameter Setting

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

  • Default value: 0

allowBlobPublicAccess#

Parameter Setting

Optional. Determines if any containers can be configured with the anonymous access types of blob or container.

  • Default value: False

keyVaultPrincipalId#

Parameter Setting

Optional. Set to the objectId of Azure Key Vault to delegated permission for use with Key Managed Storage Accounts.

tags#

Parameter Setting

Optional. Tags to apply to the resource.

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/v2/template.json"
    },
    "parameters": {
        "storageAccountName": {
            "value": "<name>"
        },
        "sku": {
            "value": "Standard_LRS"
        },
        "containers": {
            "value": [
                {
                    "name": "logs",
                    "publicAccess": "None",
                    "metadata": {}
                }
            ]
        },
        "lifecycleRules": {
            "value": {
                "enabled": true,
                "name": "<rule_name>",
                "type": "Lifecycle",
                "definition": {
                    "actions": {
                        "baseBlob": {
                            "delete": {
                                "daysAfterModificationGreaterThan": 7
                            }
                        }
                    },
                    "filters": {
                        "blobTypes": [
                            "blockBlob"
                        ],
                        "prefixMatch": [
                            "logs/"
                        ]
                    }
                }
            }
        },
        "blobSoftDeleteDays": {
            "value": 7
        },
        "containerSoftDeleteDays": {
            "value": 7
        },
        "shares": {
            "value": [
                {
                    "name": "<share_name>",
                    "shareQuota": 5,
                    "metadata": {}
                }
            ]
        },
        "shareSoftDeleteDays": {
            "value": 7
        },
        "allowBlobPublicAccess": {
            "value": false
        },
        "tags": {
            "value": {
                "service": "<service_name>",
                "env": "prod"
            }
        }
    }
}

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