> 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/public-exposure/appsec2-azure-39.md).

# Azure Virtual machine configured with public IP and serial console access misconfiguration detected

## Rule Details

|                        |                                      |
| ---------------------- | ------------------------------------ |
| Cortex AppSec Rule ID  | APPSEC2\_AZURE\_39                   |
| Category - Subcategory | Public Exposure - VPC VCN VNet       |
| Provider               | AZURE                                |
| Severity               | LOW                                  |
| Framework              | Terraform, Terraform Plan            |
| Mapped CSPM/KSPM Rule  | c1f40894-1e56-4fdf-a4a8-0ee90a9f022e |

## Impact

This rule is checking to ensure that Azure Virtual Machines are not configured with both public IP and serial console access. It is bad because having both settings enabled can expose the virtual machine to unnecessary risks.

A public IP exposes the VM to the internet, which increases its vulnerability to attacks. On the other hand, enabling serial console access gives individuals the ability to control and configure the VM via the command line or terminal. If both of these features are enabled, an attacker who gains access to the VM can easily control the entire system, leading to potential data breaches, system failures, and other severe consequences.

Therefore, this rule aims to minimize risk by checking these configurations and ensuring they are not both enabled. It is advisable to limit those VM's exposure to the public internet and restricting console access to a few necessary and trusted individuals.

## How to Fix

*Resource:* azurerm\_network\_interface

* *Arguments:* boot\_diagnostics, ip\_configuration.public\_ip\_address\_id

## To fix this issue, you need to remove the allocation of the public IP to the Azure VM and disable serial console access. \[source,go]

resource "azurerm\_network\_interface" "example" { name = "example-nic" location = azurerm\_resource\_group.example.location resource\_group\_name = azurerm\_resource\_group.example.name

ip\_configuration { name = "internal" subnet\_id = azurerm\_subnet.example.id private\_ip\_address\_allocation = "Dynamic"

* public\_ip\_address\_id = "" } }

resource "azurerm\_linux\_virtual\_machine" "example" { admin\_ssh\_key { username = "adminuser" public\_key = file("\~/.ssh/id\_rsa.pub") }

## disable\_password\_authentication = true }


---

# 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/public-exposure/appsec2-azure-39.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.
