---
# System prepended metadata

title: Untitled

---

```
- name: Create Azure VM
  hosts: localhost
  connection: local
  tasks:
  - name: Create resource group
    azure_rm_resourcegroup:
      name: Test_Ressource_G1
      location: eastus
  - name: Create virtual network
    azure_rm_virtualnetwork:
      resource_group: Test_Ressource_G1
      name: vnet_test
      address_prefixes: "10.0.0.0/16"
  - name: Add subnet
    azure_rm_subnet:
      resource_group: Test_Ressource_G1
      name: subnet_test
      address_prefix: "10.0.1.0/24"
      virtual_network: vnet_test
  - name: Create public IP address
    azure_rm_publicipaddress:
      resource_group: Test_Ressource_G1
      allocation_method: Static
      name: ip_test
    register: output_ip_address
  - name: Public IP of VM
    debug:
      msg: "The public IP is {{ output_ip_address.state.ip_address }}."
  - name: Create Network Security Group that allows SSH
    azure_rm_securitygroup:
      resource_group: Test_Ressource_G1
      name: myNetworkSecurityGroup
      rules:
        - name: SSH
          protocol: Tcp
          destination_port_range: 22
          access: Allow
          priority: 1001
          direction: Inbound
  - name: Create virtual network interface card
    azure_rm_networkinterface:
      resource_group: Test_Ressource_G1
      name: interface_test
      virtual_network: vnet_test
      subnet: subnet_test
      public_ip_name: ip_test
      security_group: myNetworkSecurityGroup
  - name: Create VM
    azure_rm_virtualmachine:
      resource_group: Test_Ressource_G1
      name: vm-test
      vm_size: Standard_DS1_v2
      admin_username: thomas
      ssh_password_enabled: false
      ssh_public_keys:
        - path: /home/thomas/.ssh/authorized_keys
          key_data: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDRGPmHXIN+gQspcpQgO4toNhUTXUYansaT/k3raeQfxUe84/yiGBFPPWT1KtbOWzhZlGIi6pUP96A2gVypt9nhd+/iyIV2N/KKxH8SqFoX0yrEOokBv7uqJUhrX+4BYQ/HF4ZYyvaYi1QlgCpiwt0T3OG1yJs1TGgf4VQWf5tGtqjkQgWsVw2VmZ84JDNmNJFLQULQIJhCWO1wcp0UtLYdOXtyZYy2CN51vyhYyQwJzVGn8XDwwhoqQMuN0d/tVmxkdwwAGal4Er4gHVBFhAWR1nL9akGHJ/VwYCxdi4bS+gCgbpeuYAACbjunP/b033blGSZ4SpVMfXjq4YIDlcvmGL8uSkuQJonhSZYeBvlCwzbpy6DyHy1gqq6FIFYJujkwC8suGhHm2rTi+pJP8rQXjcSMiNJQWutL6fvGNCiyiW9CY3MNvW0OV2ty9HUZP0yLeqAXfrbfXIrsYKZ+oNBuxZqDCZm1g61W2jUq3uxchLk+72LgvkzjEFE+nUl/RF7sCVdc566v/3Ere6KIXe9q9ZjhXvzXpqj0slYngusH29I5hd2HN29ZwbfM18fAvBmwOSXvO3WHunT41DZhLh0cR53jtRsD0tATR5HP4i3q/5SCpw+xEyz29hDrkCBAvd1u+5QFFB05fehgvlkJ4ZBa5wGwcY2t2yRGkkVZGPJxrw== thomas@thomas-VirtualBox
      image:
        offer: CentOS
        publisher: OpenLogic
        sku: '7.5'
        version: latest
```



