This command sets the “supportsHttpsTrafficOnly” and “preventEncryptionScopeOverride” properties to “true”, which enables immutable blob storage.
Verify that the immutable blob storage has been enabled for the storage account by running the following command:
Copy
Ask AI
az storage account show --name <storage_account_name> --resource-group <resource_group_name> --query properties.supportsHttpsTrafficOnly
If the command returns “true”, then immutable blob storage has been enabled successfully.
That’s it! You have successfully remediated the “Enable Immutable Blob Storage” misconfiguration for Azure using Azure CLI.
Using Python
To remediate the misconfiguration “Enable Immutable Blob Storage” in Azure using Python, you can follow these steps:
Install the Azure Blob Storage SDK for Python by running the following command in your terminal:
Copy
Ask AI
pip install azure-storage-blob
Import the necessary modules:
Copy
Ask AI
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient, __version__
Authenticate with your Azure account by providing the connection string. You can obtain the connection string from the Azure Portal, under the “Access keys” section of your storage account.
This will enable immutable blob storage on the specified container for the specified retention period. Any attempt to modify or delete a blob within this period will result in an error.Note: Immutable blob storage is only available for the Azure Blob Storage tier, not for the Azure Data Lake Storage Gen2 tier.
Assistant
Responses are generated using AI and may contain mistakes.