# Issue with dynamic inventory for azure

**URL:** <https://forum.ansible.com/t/issue-with-dynamic-inventory-for-azure/37559>\
**Category:** Ansible Project\
**Tags:** azure\
**Created:** [January 18, 2023, 8:41am UTC](https://forum.ansible.com/t/issue-with-dynamic-inventory-for-azure/37559 "2023-01-18T08:41:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhay\_srivastava](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@abhay\_srivastava](https://forum.ansible.com/u/abhay_srivastava)\
**Post date:** [January 18, 2023, 8:41am UTC](https://forum.ansible.com/t/issue-with-dynamic-inventory-for-azure/37559/1 "2023-01-18T08:41:48Z")

</div>

Hello all,

We are facing one issue with dynamic inventory of azure.

Getting below error

ansible-inventory -i test.azure\_rm.yaml --graph -vvv

_ansible-inventory [core 2.13.7]_  
_config file = /etc/ansible/ansible.cfg_  
_configured module search path = [‘/root/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]_  
_ansible python module location = /usr/lib/python3/dist-packages/ansible_  
_ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections_  
_executable location = /usr/bin/ansible-inventory_  
_python version = 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]_  
_jinja version = 3.0.3_  
_libyaml = True_  
_Using /etc/ansible/ansible.cfg as config file_  
_host\_list declined parsing /root/test.azure\_rm.yaml as it did not pass its verify\_file() method_  
_script declined parsing /root/test.azure\_rm.yaml as it did not pass its verify\_file() method_  
_Using inventory plugin ‘ansible\_collections.azure.azcollection.plugins.inventory.azure\_rm’ to process inventory source ‘/root/test.azure\_rm.yaml’_  
_toml declined parsing /root/test.azure\_rm.yaml as it did not pass its verify\_file() method_  
_[WARNING]: \* Failed to parse /root/test.azure\_rm.yaml with auto plugin: Failed to get credentials. Either pass as_  
_parameters, set environment variables, define a profile in ~/.azure/credentials, or install Azure CLI and log in (az login)._  
_File “/usr/lib/python3/dist-packages/ansible/inventory/manager.py”, line 290, in parse\_source_  
_plugin.parse(self.\_inventory, self.\_loader, source, cache=cache)_  
_File “/usr/lib/python3/dist-packages/ansible/plugins/inventory/auto.py”, line 59, in parse_  
_plugin.parse(inventory, loader, path, cache=cache)_  
_File “/root/.ansible/collections/ansible\_collections/azure/azcollection/plugins/inventory/azure\_rm.py”, line 220, in parse_  
_self.\_credential\_setup()_  
_File “/root/.ansible/collections/ansible\_collections/azure/azcollection/plugins/inventory/azure\_rm.py”, line 241, in \_credential\_setup_  
_self.azure\_auth = AzureRMAuth(\*\*auth\_options)_  
_File “/root/.ansible/collections/ansible\_collections/azure/azcollection/plugins/module\_utils/azure\_rm\_common.py”, line 1479, in init_  
_self.fail("Failed to get credentials. Either pass as parameters, set environment variables, "_  
_File “/root/.ansible/collections/ansible\_collections/azure/azcollection/plugins/module\_utils/azure\_rm\_common.py”, line 1605, in fail_  
_self.\_fail\_impl(msg)_  
_File “/root/.ansible/collections/ansible\_collections/azure/azcollection/plugins/module\_utils/azure\_rm\_common.py”, line 1608, in \_default\_fail\_impl_  
_raise AzureRMAuthException(msg)_  
_[WARNING]: \* Failed to parse /root/test.azure\_rm.yaml with yaml plugin: Plugin configuration YAML file, not YAML inventory_  
_File “/usr/lib/python3/dist-packages/ansible/inventory/manager.py”, line 290, in parse\_source_  
_plugin.parse(self.\_inventory, self.\_loader, source, cache=cache)_  
_File “/usr/lib/python3/dist-packages/ansible/plugins/inventory/yaml.py”, line 114, in parse_  
_raise AnsibleParserError(‘Plugin configuration YAML file, not YAML inventory’)_  
_[WARNING]: \* Failed to parse /root/test.azure\_rm.yaml with ini plugin: Invalid host pattern ‘plugin:’ supplied, ending in_  
_‘:’ is not allowed, this character is reserved to provide a port._  
_File “/usr/lib/python3/dist-packages/ansible/inventory/manager.py”, line 290, in parse\_source_  
_plugin.parse(self.\_inventory, self.\_loader, source, cache=cache)_  
_File “/usr/lib/python3/dist-packages/ansible/plugins/inventory/ini.py”, line 136, in parse_  
_raise AnsibleParserError(e)_  
_[WARNING]: Unable to parse /root/test.azure\_rm.yaml as an inventory source_  
_[WARNING]: No inventory was parsed, only implicit localhost is available_  
_@all:_  
_|–@ungrouped:_

Able to do az vm list  
az vm list | wc -l  
1341  
my azure inventory is below  
cat test.azure\_rm.yaml  
plugin: azure.azcollection.azure\_rm  
auth\_source: auto  
include\_vm\_resource\_groups:

- ‘\*’  
vars:  
ansible\_python\_interpreter: /usr/bin/python3

---

<div class="post-metadata">

**Author:** ![abhay\_srivastava](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@abhay\_srivastava](https://forum.ansible.com/u/abhay_srivastava)\
**Post date:** [January 18, 2023, 8:42am UTC](https://forum.ansible.com/t/issue-with-dynamic-inventory-for-azure/37559/2 "2023-01-18T08:42:24Z")

</div>



---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [January 18, 2023, 10:18am UTC](https://forum.ansible.com/t/issue-with-dynamic-inventory-for-azure/37559/3 "2023-01-18T10:18:57Z")

</div>

Hii

> Hello all,
> 
> We are facing one issue with dynamic inventory of azure.
> 
> Getting below error
> 
> ansible-inventory -i test.azure\_rm.yaml --graph -vvv

Despite not knowing anything about azure, this one seems clear to me:
