Updates the properties of a storage account.
The Set-AzStorageAccount cmdlet updates the properties of a storage account.
This cmdlet supports updating properties such as tags, SKU, and replication status. You can use it to modify existing storage accounts to meet your evolving needs.
Set-AzStorageAccount
    [-ResourceGroupName string]
    -Name string
    [-SkuName StorageAccountSkuName]
    [-Kind StorageAccountKind]
    [-EnableHttpsTrafficOnly switch]
    [-AllowBlobPublicAccess Nullable| Name | Description | Type | Required? | 
|---|---|---|---|
| -ResourceGroupName | Specifies the name of the resource group that contains the storage account. | System.String | No | 
| -Name | Specifies the name of the storage account. | System.String | Yes | 
| -SkuName | Specifies the SKU name of the storage account. Valid values are: Standard_LRS, Standard_GRS, Standard_RAGRS, Standard_ZRS, Premium_LRS, Premium_ZRS. | Microsoft.Azure.Commands.Management.Storage.Models.StorageAccountSkuName | No | 
| -Kind | Specifies the kind of storage account. Valid values are: StorageV2, BlobStorage, Storage, FileStorage. | Microsoft.Azure.Commands.Management.Storage.Models.StorageAccountKind | No | 
| -EnableHttpsTrafficOnly | Enforces that all traffic to storage account endpoints uses HTTPS. | System.Management.Automation.SwitchParameter | No | 
| -AllowBlobPublicAccess | Specifies whether to allow public access to blob containers. | System.Nullable | No | 
| -IsHnsEnabled | Specifies whether Hierarchical Namespace is enabled for the storage account. | System.Nullable | No | 
| -EnableNfsV3RootSquash | Specifies whether NFSv3 root squash is enabled for the storage account. | System.Nullable | No | 
| -PublicNetworkAccess | Specifies the public network access for the storage account. Valid values are Enabled, Disabled, SecuredByPerimeter. | Microsoft.Azure.Commands.Management.Storage.Models.PublicNetworkAccessType | No | 
| -KeyVaultEncryption | Specifies the Key Vault properties for storage account encryption. | Microsoft.Azure.Commands.Management.Storage.Models.KeyVaultProperties | No | 
| -KeyEncryptionKeyUrl | The URL of the Key Vault key for customer-managed key encryption. | System.String | No | 
| -KeyEncryptionKeyVaultResourceId | The resource ID of the Key Vault for customer-managed key encryption. | System.String | No | 
| -AccessTier | Specifies the access tier for the storage account. Valid values are Hot and Cool. | Microsoft.Azure.Commands.Management.Storage.Models.AccessTier | No | 
| -InputObject | Specifies the storage account object to update. | Microsoft.Azure.Commands.Management.Storage.Models.PSStorageAccount | No | 
| -Force | Forces the command to run without asking for confirmation. | System.Management.Automation.SwitchParameter | No | 
| -AsJob | Run cmdlet in the background. | System.Management.Automation.SwitchParameter | No | 
| -DefaultProfile | The credentials, account, tenant, and subscription for the cloud service. | Microsoft.Azure.ServicePrincipal.Extensions.Common.IAzureContextContainer | No | 
| -WhatIf | Shows what would happen if the cmdlet runs. The cmdlet is not run. | System.Management.Automation.SwitchParameter | No | 
| -Confirm | Prompts you for confirmation before running the cmdlet. | System.Management.Automation.SwitchParameter | No | 
Example 1: Update storage account properties
Set-AzStorageAccount -ResourceGroupName "MyResourceGroup" -Name "mystorageaccount" -SkuName "Standard_GRS" -AllowBlobPublicAccess:$false -EnableHttpsTrafficOnly
This command updates the storage account named "mystorageaccount" in the "MyResourceGroup" resource group to use the "Standard_GRS" SKU, disables public blob access, and enforces HTTPS traffic only.
Example 2: Enable Hierarchical Namespace
Set-AzStorageAccount -Name "myadlsgen2account" -ResourceGroupName "MyDataLakeRG" -IsHnsEnabled $true
This command enables the Hierarchical Namespace feature for the specified storage account, preparing it for use with Azure Data Lake Storage Gen2.
Example 3: Set Access Tier to Cool
Set-AzStorageAccount -Name "myblobstorage" -ResourceGroupName "MyBlobRG" -AccessTier Cool
This command changes the default access tier for blobs in the specified storage account to "Cool," which is suitable for data that is accessed less frequently.
The Set-AzStorageAccount cmdlet is a powerful tool for managing Azure Storage accounts. Always ensure you understand the implications of the changes you are making, especially when modifying critical properties like SKU or access tiers.
For customer-managed key encryption, ensure that the specified Key Vault and Key are accessible and correctly configured.
When using the -InputObject parameter, it's recommended to first retrieve the storage account object using Get-AzStorageAccount and then pipe it to Set-AzStorageAccount.