az group create --name bicep-lab-rg --location eastus
Build a reusable Bicep module for a Storage Account with security defaults. Modules are composable building blocks — write once, use anywhere.
1 @description('Name of the storage account (globally unique, 3-24 chars, lowercase)') 2 param name string 3 4 @description('Azure region for the storage account') 5 param location string 6 7 @description('Storage SKU for replication type') 8 @allowed(['Standard_LRS', 'Standard_GRS', 'Standard_RAGRS', 'Premium_LRS']) 9 param skuName string = 'Standard_LRS' 10 11 @description('Resource tags') 12 param tags object = {} 13 14 // Storage Account with security defaults 15 resource storageAccount 'Microsoft.Storage/storageAccounts@2024-01-01' = { 16 name: name 17 location: location 18 tags: tags 19 sku: { 20 name: skuName 21 } 22 kind: 'StorageV2' 23 properties: { 24 minimumTlsVersion: 'TLS1_2' 25 allowBlobPublicAccess: false 26 supportsHttpsTrafficOnly: true 27 accessTier: 'Hot' 28 } 29 } 30 31 // ── Outputs ── 32 output blobEndpoint string = storageAccount.properties.primaryEndpoints.blob 33 output storageAccountName string = storageAccount.name 34 output storageAccountId string = storageAccount.id
modules/storage-account.bicep with params, storage resource, and typed outputs
Sign in to share your feedback and join the discussion.