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

# Virtual Machines are not backed up using Azure Backup misconfiguration detected in code

## Rule Details

|                        |                                      |
| ---------------------- | ------------------------------------ |
| Cortex AppSec Rule ID  | APPSEC2\_AZURE\_12                   |
| Category - Subcategory | Storage - Backups                    |
| Provider               | AZURE                                |
| Severity               | LOW                                  |
| Framework              | Terraform, Terraform Plan            |
| Mapped CSPM/KSPM Rule  | b312bd01-fc58-43a3-aa37-d67fe3bd01eb |

## Impact

Ensure that Azure Backup service is enabled and configured to create server backups for your Microsoft Azure virtual machines (VMs), in order to follow data security best practices and compliance requirements. Azure Backup service is a cost-effective, one-click backup solution, that simplifies virtual machine data recovery in your Azure cloud account. Once Azure Backup service is configured, your virtual machines are backed up according to a precise schedule defined within the appropriate backup policy, then recovery points are created from those backups and stored in the Azure Recovery Services vaults.

## How to Fix

## *Resource:* azurerm\_backup\_protected\_vm, azurerm\_virtual\_machine \[source,go]

resource "azurerm\_virtual\_machine" "example\_ok" { name = "${var.prefix}-vm" location = azurerm\_resource\_group.main.location resource\_group\_name = azurerm\_resource\_group.main.name network\_interface\_ids = \[azurerm\_network\_interface.main.id] vm\_size = "Standard\_DS1\_v2" }

## resource "azurerm\_backup\_protected\_vm" "vm\_protected\_backup" { resource\_group\_name = azurerm\_resource\_group.example\_ok.name recovery\_vault\_name = azurerm\_recovery\_services\_vault.example\_ok.name source\_vm\_id = azurerm\_virtual\_machine.example\_ok.id backup\_policy\_id = azurerm\_backup\_policy\_vm.example\_ok.id }


---

# 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-12.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.
