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

# Linux VM Without SSH Key misconfiguration detected in code

## Linux VM Without SSH Key misconfiguration detected in code

### Rule Details

|                        |                                            |
| ---------------------- | ------------------------------------------ |
| Cortex AppSec Rule ID  | APPSEC\_AZURE\_178                         |
| Category - Subcategory | Public Exposure - Encryption And Protocols |
| Provider               | AZURE                                      |
| Severity               | HIGH                                       |
| Framework              | ARM, Bicep, Terraform, Terraform Plan      |

### Impact

SSH (Secure Shell) provides encrypted communication sessions for Linux VMs in a potentially insecure network. Utilizing SSH keys rather than passwords enhances the security even further. SSH keys are more secure and complex than passwords and are more challenging for attackers to compromise.

This rule checks to ensure that Linux VMs and Linux VM Scale Sets in Azure are configured to use SSH keys for authentication.

### How to Fix

*Resources:*

* azurerm\_linux\_virtual\_machine
* azurerm\_linux\_virtual\_machine\_scale\_set

*Argument:*

* admin\_ssh\_key

### Note: It's recommended to enable SSH with keys on all Linux VM and VM Scale Set instances in Azure to ensure secure communication and authentication. \[source,go]

resource "azurerm\_linux\_virtual\_machine" "example" { name = "example-linux-vm" location = azurerm\_resource\_group.example.location resource\_group\_name = azurerm\_resource\_group.example.name

## ... other configurations ...

* admin\_ssh\_key {
* username = "adminuser"
* public\_key = file("\~/.ssh/id\_rsa.pub") } }

resource "azurerm\_linux\_virtual\_machine\_scale\_set" "example" { name = "example-linux-vmss" location = azurerm\_resource\_group.example.location resource\_group\_name = azurerm\_resource\_group.example.name

## ... other configurations ...

* admin\_ssh\_key {
* username = "adminuser"
* public\_key = file("\~/.ssh/id\_rsa.pub") } }

***


---

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