# The following variables must be specified:
# - vmname
# - resgrp
- name: Remove Virtual Machine and associated objects
  hosts: localhost
  connection: local
  gather_facts: no
  tasks:
  - name: Remove VM and all resources
    azure_rm_virtualmachine:
      resource_group: '{{ resgrp }}'
      name: '{{ vmname }}'
      state: absent
      # ignore_errors: yes
      remove_on_absent:
        - network_interfaces
        - virtual_storage
        - public_ips
  - name: Remove storage account
    azure_rm_storageaccount:
      resource_group: '{{ resgrp }}'
      name:  '{{ vmname }}'
      state: absent
      # ignore_errors: yes

# The following variables must be specified:
# - vmname
# - resgrp
- name: Remove Virtual Machine and associated objects
  hosts: localhost
  connection: local
  gather_facts: no
  tasks:
  - name: Remove VM and all resources
    azure_rm_virtualmachine:
      resource_group: '{{ resgrp }}'
      name: '{{ vmname }}'
      state: absent
      # ignore_errors: yes
      remove_on_absent:
        - network_interfaces
        - virtual_storage
        - public_ips
  - name: Remove storage account
    azure_rm_storageaccount:
      resource_group: '{{ resgrp }}'
      name:  '{{ vmname }}'
      state: absent
      # ignore_errors: yes
  - name: Remove security group
    azure_rm_securitygroup:
      resource_group: '{{ resgrp }}'
      name: '{{ vmname }}'
      state: absent

Fix Azure teardown not removing created security group
Fix Azure teardown not removing created security group
