# The error was: ModuleNotFoundError: No module named 'azure.mgmt.managementgroups

**URL:** <https://forum.ansible.com/t/the-error-was-modulenotfounderror-no-module-named-azure-mgmt-managementgroups/41660>\
**Category:** Get Help\
**Tags:** azure\
**Created:** [April 10, 2025, 4:54pm UTC](https://forum.ansible.com/t/the-error-was-modulenotfounderror-no-module-named-azure-mgmt-managementgroups/41660 "2025-04-10T16:54:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![elduke88](https://avatars.discourse-cdn.com/v4/letter/e/c4cdca/32.png) [@elduke88](https://forum.ansible.com/u/elduke88)\
**Post date:** [April 10, 2025, 4:54pm UTC](https://forum.ansible.com/t/the-error-was-modulenotfounderror-no-module-named-azure-mgmt-managementgroups/41660/1 "2025-04-10T16:54:07Z")

</div>

ansible [core 2.17.10]  
config file = /etc/ansible/ansible.cfg  
configured module search path = [‘/home/azureuser/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/local/lib/python3.10/dist-packages/ansible  
ansible collection location = /home/azureuser/.ansible/collections:/usr/share/ansible/collections  
executable location = /usr/local/bin/ansible  
python version = 3.10.12 (main, Feb 4 2025, 14:57:36) [GCC 11.4.0] (/usr/bin/python3.10)  
jinja version = 3.1.6

the python interpreter is set to the correct path, and the package is there. could this be version?  
python 3.10  
ansible 2.17.10

# /home/azureuser/.ansible/collections/ansible\_collections

Collection Version

* * *

azure.azcollection 3.3.1

# /usr/local/lib/python3.10/dist-packages/ansible\_collections

Collection Version

* * *

azure.azcollection 2.7.0

pip list returns this  
azure-mgmt-managementgroups 1.0.0

```auto
- my code!

```

- Set at least one tag (the experts follow the tags, so the right people will find you if you tag)  
python ansible azure

---

<div class="post-metadata">

**Author:** ![Lyle\_McKarns](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/lyle_mckarns/32/8142_2.png) [@Lyle\_McKarns](https://forum.ansible.com/u/Lyle_McKarns)\
**Post date:** [April 10, 2025, 5:09pm UTC](https://forum.ansible.com/t/the-error-was-modulenotfounderror-no-module-named-azure-mgmt-managementgroups/41660/3 "2025-04-10T17:09:01Z")

</div>

You can run `ansible-galaxy collection list` and see if its installed. if not, you can run `ansible-galaxy collection install azure.azcollection` to install it (as well as installing all all the things required in its [requirements.txt](https://github.com/ansible-collections/azure/blob/dev/requirements.txt))

---

<div class="post-metadata">

**Author:** ![elduke88](https://avatars.discourse-cdn.com/v4/letter/e/c4cdca/32.png) [@elduke88](https://forum.ansible.com/u/elduke88)\
**Post date:** [April 10, 2025, 7:40pm UTC](https://forum.ansible.com/t/the-error-was-modulenotfounderror-no-module-named-azure-mgmt-managementgroups/41660/4 "2025-04-10T19:40:49Z")

</div>

it looks as if it is installed

---

<div class="post-metadata">

**Author:** ![Lyle\_McKarns](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/lyle_mckarns/32/8142_2.png) [@Lyle\_McKarns](https://forum.ansible.com/u/Lyle_McKarns)\
**Post date:** [April 10, 2025, 7:44pm UTC](https://forum.ansible.com/t/the-error-was-modulenotfounderror-no-module-named-azure-mgmt-managementgroups/41660/5 "2025-04-10T19:44:50Z")

</div>

It sounds like you might be addressing it incorrectly (I don’t see example code listed, so I can’t be sure). Based on [the documentation I found](https://docs.ansible.com/ansible/latest/collections/azure/azcollection/azure_rm_managementgroup_module.html#examples) it likely needs do be

```auto
- name: my cool task
  azure_rm_managementgroup:

```

instead of (what I am assuming you’re doing, based on the error you shared)

```auto
- name: my cool task
  azure.mgmt.managementgroup:

```

---

<div class="post-metadata">

**Author:** ![elduke88](https://avatars.discourse-cdn.com/v4/letter/e/c4cdca/32.png) [@elduke88](https://forum.ansible.com/u/elduke88)\
**Post date:** [April 10, 2025, 7:47pm UTC](https://forum.ansible.com/t/the-error-was-modulenotfounderror-no-module-named-azure-mgmt-managementgroups/41660/6 "2025-04-10T19:47:08Z")

</div>

pip list shows this  
azure-mgmt-keyvault 1.1.0  
azure-mgmt-loganalytics 1.0.0  
azure-mgmt-managedservices 1.0.0  
azure-mgmt-managementgroups 1.0.0  
azure-mgmt-marketplaceordering 0.1.0  
azure-mgmt-monitor 0.5.2

---

<div class="post-metadata">

**Author:** ![bcoca](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bcoca/32/9269_2.png) [@bcoca](https://forum.ansible.com/u/bcoca)\
**Post date:** [April 11, 2025, 2:12pm UTC](https://forum.ansible.com/t/the-error-was-modulenotfounderror-no-module-named-azure-mgmt-managementgroups/41660/7 "2025-04-11T14:12:55Z")

</div>

Ansible is using this specific python `/usr/bin/python3.10`, ensure you are using the corresponding pip, even better, use it as python module `/usr/bin/python3.10 -m pip ...`
