No Network Security Group is attached to the Virtual Machine

ID

azure_vm_not_attached_network

Severity

high

Vendor

Azure

Resource

Network

Tags

reachable

Description

No Network Security Group is attached to the Virtual Machine. If a network interface name is not provided when the VM is created, a default network interface will be created.

You must configure network_interface_names or network_interfaces properties.

Learn more about this topic at Azure network interface names.

Examples

---
- name: Example playbook
  hosts: localhost
  tasks:
    - name: Create a VM with existing storage account and NIC
      azure_rm_virtualmachine:
        resource_group: myResourceGroup
        name: testvm002
        vm_size: Standard_D4
        storage_account: testaccount001
        admin_username: "{{ username }}"
        ssh_public_keys:
          - path: /home/adminUser/.ssh/authorized_keys
            key_data: < insert your ssh public key here... >
        image:
          offer: CentOS
          publisher: OpenLogic
          sku: '7.1'
          version: latest

Mitigation / Fix

---
- name: Example playbook
  hosts: localhost
  tasks:
    - name: Create a VM with existing storage account and NIC
      azure_rm_virtualmachine:
        resource_group: myResourceGroup
        name: testvm002
        vm_size: Standard_D4
        storage_account: testaccount001
        admin_username: "{{ username }}"
        ssh_public_keys:
          - path: /home/adminUser/.ssh/authorized_keys
            key_data: < insert your ssh public key here... >
        network_interfaces: testvm001
        image:
          offer: CentOS
          publisher: OpenLogic
          sku: '7.1'
          version: latest