Eduardo Medeiros

Eduardo Medeiros

System Engineer.

© 2022

About me

Browse by categories

Ansible: How-to install Azure Resource Manager inventory plugin (part 1)


This plugin allows you to work with dynamic inventory on Azure.


  • Support VMSS
  • Conditional groups based on the name of the instances.
  • Key group tags creation
  • Multiples authentication methods way


Install azure cli

Install azure inventory plugin

$ pip install 'ansible[azure]'


Create a new file called azure_rm.yml

plugin: azure_rm
auth_source: auto
# Include VMSS.
  - '*'

Setup Azure subscription settings

Azure cli

$ az login
$ az account set --subscription <subscription_name>

Invoking ansible cli.

Listing all hosts

$ ansible-inventory -i azure_rm.yml --list all


$ ansible all -m ping -i azure_rm.yml -u <ansible_user> --key-file "<ansible_user_ssh_key_file>"

If you did not get any error, it’s working properly.

Next post, I will give some ideas how to improve the inventory.