> 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-1.md).

# Storage for critical data are not encrypted with Customer Managed Key misconfiguration detected in c

## Rule Details

|                        |                           |
| ---------------------- | ------------------------- |
| Cortex AppSec Rule ID  | APPSEC2\_AZURE\_1         |
| Category - Subcategory | Storage - Encryption      |
| Provider               | AZURE                     |
| Severity               | HIGH                      |
| Framework              | Terraform, Terraform Plan |

## Impact

Enable sensitive data encryption at rest using Customer Managed Keys (CMKs) rather than Microsoft Managed keys. By default, data in the storage account is encrypted using Microsoft Managed Keys at rest. All Azure Storage resources are encrypted, including blobs, disks, files, queues, and tables. All object metadata is also encrypted. However, if you want to control and manage this encryption key yourself, you can specify a customer-managed key, that key is used to protect and control access to the key that encrypts your data. You can also choose to automatically update the key version used for Azure Storage encryption whenever a new version is available in the associated Key Vault.

## How to Fix

## *Resource:* azurerm\_resource\_group, azurerm\_key\_vault, azurerm\_key\_vault\_access\_policy, azurerm\_key\_vault\_key, azurerm\_storage\_account, azurerm\_storage\_account\_customer\_managed\_key \[source,go]

data "azurerm\_client\_config" "current" {}

resource "azurerm\_resource\_group" "example" { name = "example-resources" location = "West Europe" }

resource "azurerm\_key\_vault" "example" { name = "examplekv" location = azurerm\_resource\_group.example.location resource\_group\_name = azurerm\_resource\_group.example.name tenant\_id = data.azurerm\_client\_config.current.tenant\_id sku\_name = "standard"

purge\_protection\_enabled = true }

resource "azurerm\_key\_vault\_access\_policy" "client" { key\_vault\_id = azurerm\_key\_vault.example.id tenant\_id = data.azurerm\_client\_config.current.tenant\_id object\_id = data.azurerm\_client\_config.current.object\_id

key\_permissions = \["Get", "Create", "Delete", "List", "Restore", "Recover", "UnwrapKey", "WrapKey", "Purge", "Encrypt", "Decrypt", "Sign", "Verify"] secret\_permissions = \["Get"] }

resource "azurerm\_key\_vault\_key" "example" { name = "tfex-key" key\_vault\_id = azurerm\_key\_vault.example.id key\_type = "RSA" key\_size = 2048 key\_opts = \["decrypt", "encrypt", "sign", "unwrapKey", "verify", "wrapKey"]

depends\_on = \[ azurerm\_key\_vault\_access\_policy.client ] }

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

identity { type = "SystemAssigned" } }

## resource "azurerm\_storage\_account\_customer\_managed\_key" "ok\_cmk" { storage\_account\_id = azurerm\_storage\_account.ok\_storage\_account.id key\_vault\_id = azurerm\_key\_vault.example.id key\_name = azurerm\_key\_vault\_key.example.name }


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
