> 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/appsec-azure-42.md).

# Azure Key Vault is not recoverable misconfiguration detected in code

## Rule Details

|                        |                                       |
| ---------------------- | ------------------------------------- |
| Cortex AppSec Rule ID  | APPSEC\_AZURE\_42                     |
| Category - Subcategory | Storage - Backups                     |
| Provider               | AZURE                                 |
| Severity               | LOW                                   |
| Framework              | ARM, Bicep, Terraform, Terraform Plan |
| Mapped CSPM/KSPM Rule  | 045f2c23-66af-40ef-a0cf-e04f5cda9843  |

## Impact

The key vault contains object keys, secrets and certificates. Accidental unavailability of a key vault can cause immediate data loss or loss of security functions supported by the key vault objects, such as authentication, validation, verification, and non-repudiation. Deleting or purging a key vault leads to immediate data loss as keys encrypting data, including storage accounts, SQL databases, and/or dependent services provided by key vault objects, such as keys, secrets, and certificates. We recommended you make the key vault recoverable by enabling the *Do Not Purge* and *Soft Delete* functions. This will prevent accidental deletion by a user running the delete/purge command on the key vault, or an attacker/malicious user does to deliberately to cause disruption.

## How to Fix

*Resource:* azurerm\_key\_vault

* *Arguments:* soft\_delete\_enabled + purge\_protection\_enabled \[source,go]

***

resource "azurerm\_key\_vault" "example" { ...

* purge\_protection\_enabled = true
* soft\_delete\_retention\_days = 7 # Default is 90 }

***


---

# 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/appsec-azure-42.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.
