References:
A virtual conversation with a coffee is always my favorite. This morning, I had a chat with my friend in the UK. I was excited to know about an issue in the Azure portal, “Life Cycle Management” settings of a storage account with ADLS Gen 2 (hierarchy namespace enabled) is not appearing. I shared an ARM template way back to the team to set a few properties as part of the cost-saving.
- tierttocool
- daysAfterModificationGreaterThan = 30
- tiertoArchive
- daysAfterModificationGreaterThan = 90
- delete
- daysAfterModificationGreaterThan = 2555
I got a note that the development team couldn’t confirm the solution to close the case. Upon successful execution of the ARM template through Azure pipelines, the result (Life Cycle Management) isn’t visible under blob service.
AFAIK, it’s a glitch in the portal, and PowerShell is the way to confirm. Take a look at the gist of the ARM template to create a storage account with HNS (Hirerchial Namespace) enabled.
{ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { }, "variables": { }, "resources": [ { "name": "[concat('istg003', '/default')]", "type": "Microsoft.Storage/storageAccounts/managementPolicies", "apiVersion": "2019-04-01", "dependsOn": [ "[resourceId('Microsoft.Storage/storageAccounts' , 'istg003')]" ], "properties": { "policy": { "rules": [ { "name": "MyCustomRule-CostSaving", "enabled": true, "type": "Lifecycle", "definition": { "filters": { "blobTypes": [ "blockBlob" ] }, "actions": { "baseBlob": { "tierToCool": { "daysAfterModificationGreaterThan": 20 }, "tierToArchive": { "daysAfterModificationGreaterThan": 90 }, "delete": { "daysAfterModificationGreaterThan": 2555 } } } } } ] } } }, { "name": "istg003", "type": "Microsoft.Storage/storageAccounts", "apiVersion": "2019-06-01", "location": "[resourceGroup().location]", "tags": { "displayName": "istg003" }, "properties": { "accountType": "STANDARD_RAGRS", "isHnsEnabled": true }, "sku": { "name": "Standard_RAGRS", "tier": "Standard" }, "kind": "StorageV2" } ], "outputs": { }, "functions": [ ] }
To check the storage account management policy, use the below snippet
Get-AzStorageAccountManagementPolicy -ResourceGroupName iContoso -StorageAccountName istg003
Output