> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/storage/appsec2-azure-38.md).

# Azure Storage account soft delete is disabled misconfiguration detected in code

## Rule Details

|                        |                                      |
| ---------------------- | ------------------------------------ |
| Cortex AppSec Rule ID  | APPSEC2\_AZURE\_38                   |
| Category - Subcategory | Storage - Backups                    |
| Provider               | AZURE                                |
| Severity               | LOW                                  |
| Framework              | Terraform, Terraform Plan            |
| Mapped CSPM/KSPM Rule  | 854edc33-62b4-46c0-83a1-2774ae9ae4ff |

## Impact

This rule is checking to see if the soft-delete feature is enabled on Azure storage accounts. It's important to have soft-delete enabled because it provides a safeguard against accidental deletion of data. It keeps deleted data available for recovery for a certain period, preventing any loss due to human error, programmatic errors, or malicious activities. Without this feature, deleted data is irretrievable, potentially causing data loss which can have severe consequences for businesses.

## How to Fix

*Resource:* azurerm\_storage\_account

* *Arguments:* blob\_properties.delete\_retention\_policy.days, blob\_properties.delete\_retention\_policy, account\_kind

To fix this issue, you need to enable the soft-delete option in the configuration of your Azure storage account.

In the resource block "azurerm\_storage\_account", the sub-block "blob\_properties" contains a "delete\_retention\_policy" block. This block contains an attribute called days. When you set a number for this attribute, it specifies the number of days the deleted blobs should be retained in the Storage account. In the example above, it is set to 7 days. If the value of "days" is set to 0, soft delete is disabled for the Azure Storage account.

## By enabling soft-delete, this gives you the opportunity to restore the blob data when it is accidentally deleted. It is a layer of protection that can serve as a backup. This increases the security of your data stored on Azure. \[source,go]

resource "azurerm\_storage\_account" "example" { name = "examplestoracc" resource\_group\_name = azurerm\_resource\_group.example.name location = azurerm\_resource\_group.example.location account\_tier = "Standard" account\_replication\_type = "GRS"

## blob\_properties { delete\_retention\_policy { days = 7 } } }


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/storage/appsec2-azure-38.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
