# Azure.azcollection:2.6.0 still using az-cli to authenticate even when using service principal way of doing it

**URL:** <https://forum.ansible.com/t/azure-azcollection-2-6-0-still-using-az-cli-to-authenticate-even-when-using-service-principal-way-of-doing-it/8294>\
**Category:** Get Help\
**Tags:** azure, playbook, collections, ansible-core, galaxy-ng\
**Created:** [September 6, 2024, 11:33am UTC](https://forum.ansible.com/t/azure-azcollection-2-6-0-still-using-az-cli-to-authenticate-even-when-using-service-principal-way-of-doing-it/8294 "2024-09-06T11:33:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mayank\_gupta](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mayank_gupta/32/2995_2.png) [@mayank\_gupta](https://forum.ansible.com/u/mayank_gupta)\
**Post date:** [September 6, 2024, 11:33am UTC](https://forum.ansible.com/t/azure-azcollection-2-6-0-still-using-az-cli-to-authenticate-even-when-using-service-principal-way-of-doing-it/8294/1 "2024-09-06T11:33:27Z")

</div>

we are trying to upload a txt file to a azure blob storage using ansible playbook.  
We are using azure.azcollection.azure\_rm\_storageblob package to perform the upload.  
My azure.azcollection version is 2.6.0

**auto@32fb1b2fe9a1:/$ ansible-galaxy collection list**

**# /usr/local/lib/python3.9/site-packages/ansible\_collections**  
**Collection Version**  
**----------------------------- -------**  
**azure.azcollection 2.6.0**

and ansibel version is ansible-core==2.15.5

the ansible playbook content is

**—**  
**- name: Upload a test file to Azure Blob**  
\*\* hosts: localhost\*\*  
\*\* tasks:\*\*  
\*\* - name: Upload a test file to Azure Blob\*\*  
\*\* azure.azcollection.azure\_rm\_storageblob:\*\*  
\*\* subscription\_id: “{{ lookup(‘env’, ‘AZURE\_SUBSCRIPTION\_ID’) }}”\*\*  
\*\* client\_id: “{{ lookup(‘env’, ‘AZURE\_CLIENT\_ID’) }}”\*\*  
\*\* secret: “{{ lookup(‘env’, ‘AZURE\_SECRET’) }}”\*\*  
\*\* tenant: “{{ lookup(‘env’, ‘AZURE\_TENANT’) }}”\*\*  
\*\* storage\_account\_name: “your\_storage\_account\_name”\*\*  
\*\* resource\_group: “your\_resource\_group”\*\*  
\*\* container: “your\_container\_name”\*\*  
\*\* blob: “test\_blob\_name”\*\*  
\*\* src: “/path/to/your/local\_file.txt”\*\*  
\*\* state: present\*\*

we have exported the env var as  
export AZURE\_SUBSCRIPTION\_ID=“your\_subscription\_id”  
export AZURE\_CLIENT\_ID=“your\_client\_id”  
export AZURE\_SECRET=“your\_secret”  
export AZURE\_TENANT=“your\_tenant\_id”

but still getting belwo error where it is expecting azure-cli , which should not be rthe case as per documentation. It should use service principal for authentication and not azure cli.

err:  
auto@d306e2ceedee:~$ ansible-playbook test.yml  
[WARNING]: No inventory was parsed, only implicit localhost is available  
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’

PLAY [Test Azure Blob Upload] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [localhost]

TASK [Upload a test file to Azure Blob] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named ‘azure.cli’  
fatal: [localhost]: FAILED! =\> {“changed”: false, “msg”: “Failed to import the required Python library (ansible[azure] (azure \>= 2.0.0)) on d306e2ceedee’s Python /usr/local/bin/python. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible\_python\_interpreter”}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

## **verbose stacktrace**

The full traceback is:  
Traceback (most recent call last):  
File “/tmp/ansible\_azure.azcollection.azure\_rm\_storageblob\_payload\_p5jrzqbn/ansible\_azure.azcollection.azure\_rm\_storageblob\_payload.zip/ansible\_collections/azure/azcollection/plugins/module\_utils/azure\_rm\_common.py”, line 243, in   
from azure.cli.core import cloud as azure\_cloud  
ModuleNotFoundError: No module named ‘azure.cli’

- 

> EDIT PART

- 

* * *

My oppologies for the confusion here.  
While capturing the details by mistake took Screen shots from two different conatiners but they were both spinned up with same image.  
However i am attaching the details again as the problem is still persisting.

**autotron@c08393297018:~$ ansible-galaxy collection list**

# /usr/local/lib/python3.9/site-packages/ansible\_collections

Collection Version

* * *

amazon.aws 6.5.0  
ansible.netcommon 5.2.0  
ansible.posix 1.5.4  
ansible.utils 2.11.0  
ansible.windows 1.14.0  
arista.eos 6.1.2  
awx.awx 22.7.0  
**azure.azcollection 2.6.0**

**autotron@c08393297018:~$ ansible-playbook test.yml**

**[WARNING]: No inventory was parsed, only implicit localhost is available**

**[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’**

PLAY [Upload file to Azure Blob] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

ok: [localhost]

TASK [Upload file to Azure Blob] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

**An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named ‘azure.cli’**

fatal: [localhost]: FAILED! =\> {“changed”: false, “msg”: “Failed to import the required Python library (ansible[azure] (azure \>= 2.0.0)) on c08393297018’s Python /usr/local/bin/python. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible\_python\_interpreter”}

---

<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:** [September 6, 2024, 7:14pm UTC](https://forum.ansible.com/t/azure-azcollection-2-6-0-still-using-az-cli-to-authenticate-even-when-using-service-principal-way-of-doing-it/8294/2 "2024-09-06T19:14:54Z")

</div>

Hii

> > > [mayank\_gupta](http://forum.ansible.com/u/mayank_gupta)  
> > > September 6 |
> > 
> > - | - |
> 
> we are trying to upload a txt file to a azure blob storage using ansible playbook.  
> We are using azure.azcollection.azure\_rm\_storageblob package to perform the upload.  
> My azure.azcollection version is 2.6.0
> 
> **auto@32fb1b2fe9a1:/$ ansible-galaxy collection list**
> 
> **# /usr/local/lib/python3.9/site-packages/ansible\_collections**  
> **Collection Version**  
> **----------------------------- -------**  
> **azure.azcollection 2.6.0**

That is on host **32fb1b2fe9a1.**

> TASK [Upload a test file to Azure Blob] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named ‘azure.cli’  
> fatal: [localhost]: FAILED! =\> {“changed”: false, “msg”: “Failed to import the required Python library (ansible[azure] (azure \>= 2.0.0)) on d306e2ceedee’s Python /usr/local/bin/python.

While the reported error is on host d306e2ceedee.  
So, you should make sure to install it on host d306e2ceedee.

Dick

---

<div class="post-metadata">

**Author:** ![mayank\_gupta](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mayank_gupta/32/2995_2.png) [@mayank\_gupta](https://forum.ansible.com/u/mayank_gupta)\
**Post date:** [September 7, 2024, 7:04am UTC](https://forum.ansible.com/t/azure-azcollection-2-6-0-still-using-az-cli-to-authenticate-even-when-using-service-principal-way-of-doing-it/8294/3 "2024-09-07T07:04:59Z")

</div>

Hi @dnmvisser .  
Sorry for the confusion, My appologies i might have capture the error logs on different containers but issue is there. I am putting the error SS again here.

autotron@c08393297018:~$ ansible-galaxy collection list

# /usr/local/lib/python3.9/site-packages/ansible\_collections

Collection Version

* * *

amazon.aws 6.5.0  
ansible.netcommon 5.2.0  
ansible.posix 1.5.4  
ansible.utils 2.11.0  
ansible.windows 1.14.0  
arista.eos 6.1.2  
awx.awx 22.7.0  
**azure.azcollection 2.6.0**

autotron@c08393297018:~$ ansible-playbook test.yml

**[WARNING]: No inventory was parsed, only implicit localhost is available**

**[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’**

PLAY [Upload file to Azure Blob] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

ok: [localhost]

TASK [Upload file to Azure Blob] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named ‘azure.cli’

fatal: [localhost]: FAILED! =\> {“changed”: false, “msg”: **"Failed to import the required Python library (ansible[azure] (azure \>= 2.0.0)) on c08393297018’s** Python /usr/local/bin/python. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible\_python\_interpreter"}

---

<div class="post-metadata">

**Author:** ![mayank\_gupta](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mayank_gupta/32/2995_2.png) [@mayank\_gupta](https://forum.ansible.com/u/mayank_gupta)\
**Post date:** [September 7, 2024, 7:08am UTC](https://forum.ansible.com/t/azure-azcollection-2-6-0-still-using-az-cli-to-authenticate-even-when-using-service-principal-way-of-doing-it/8294/4 "2024-09-07T07:08:37Z")

</div>

Hi @dnmvisser  
Thanks for reply.  
My appologies for the confusion. The capture was done from 2 different containers but with same image. However i am adding the details again from same container and the problem poersists.

autotron@c08393297018:~$ ansible-galaxy collection list

# /usr/local/lib/python3.9/site-packages/ansible\_collections

Collection Version

* * *

amazon.aws 6.5.0  
ansible.netcommon 5.2.0  
ansible.posix 1.5.4  
ansible.utils 2.11.0  
ansible.windows 1.14.0  
arista.eos 6.1.2  
awx.awx 22.7.0  
**azure.azcollection 2.6.0**

autotron@c08393297018:~$ ansible-playbook test.yml

**[WARNING]: No inventory was parsed, only implicit localhost is available**

**[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’**

PLAY [Upload file to Azure Blob] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

ok: [localhost]

TASK [Upload file to Azure Blob] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

An exception occurred during task execution. To see the full traceback, use -vvv. **The error was: ModuleNotFoundError: No module named ‘azure.cli’**

fatal: [localhost]: FAILED! =\> {“changed”: false, “msg”: “Failed to import the required Python library (ansible[azure] (azure \>= 2.0.0)) on c08393297018’s Python /usr/local/bin/python. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible\_python\_interpreter”}

---

<div class="post-metadata">

**Author:** ![mayank\_gupta](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mayank_gupta/32/2995_2.png) [@mayank\_gupta](https://forum.ansible.com/u/mayank_gupta)\
**Post date:** [September 7, 2024, 7:12am UTC](https://forum.ansible.com/t/azure-azcollection-2-6-0-still-using-az-cli-to-authenticate-even-when-using-service-principal-way-of-doing-it/8294/5 "2024-09-07T07:12:22Z")

</div>

Hi @dnmvisser  
Thanks for the reply.  
My oppologies for the confusion here.  
While capturing the details by mistake took Screen shots from two different conatiners but they were both spinned up with same image.  
However i am attaching the details again as the problem is still persisting.

**autotron@c08393297018:~$ ansible-galaxy collection list**

# /usr/local/lib/python3.9/site-packages/ansible\_collections

Collection Version

* * *

amazon.aws 6.5.0  
ansible.netcommon 5.2.0  
ansible.posix 1.5.4  
ansible.utils 2.11.0  
ansible.windows 1.14.0  
arista.eos 6.1.2  
awx.awx 22.7.0  
**azure.azcollection 2.6.0**

**autotron@c08393297018:~$ ansible-playbook test.yml**

**[WARNING]: No inventory was parsed, only implicit localhost is available**

**[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’**

PLAY [Upload file to Azure Blob] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

ok: [localhost]

TASK [Upload file to Azure Blob] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

**An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named ‘azure.cli’**

fatal: [localhost]: FAILED! =\> {“changed”: false, “msg”: “Failed to import the required Python library (ansible[azure] (azure \>= 2.0.0)) on c08393297018’s Python /usr/local/bin/python. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible\_python\_interpreter”}

---

<div class="post-metadata">

**Author:** ![mayank\_gupta](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mayank_gupta/32/2995_2.png) [@mayank\_gupta](https://forum.ansible.com/u/mayank_gupta)\
**Post date:** [September 7, 2024, 10:22am UTC](https://forum.ansible.com/t/azure-azcollection-2-6-0-still-using-az-cli-to-authenticate-even-when-using-service-principal-way-of-doing-it/8294/6 "2024-09-07T10:22:10Z")

</div>

Hi @dnmvisser  
Thanks for the reply.  
My oppologies for the confusion here.  
While capturing the details by mistake took Screen shots from two different conatiners but they were both spinned up with same image.  
However i am attaching the details again as the problem is still persisting.

**autotron@c08393297018:~$ ansible-galaxy collection list**

# /usr/local/lib/python3.9/site-packages/ansible\_collections

Collection Version

* * *

amazon.aws 6.5.0  
ansible.netcommon 5.2.0  
ansible.posix 1.5.4  
ansible.utils 2.11.0  
ansible.windows 1.14.0  
arista.eos 6.1.2  
awx.awx 22.7.0  
**azure.azcollection 2.6.0**

**autotron@c08393297018:~$ ansible-playbook test.yml**

**[WARNING]: No inventory was parsed, only implicit localhost is available**

**[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’**

PLAY [Upload file to Azure Blob] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

ok: [localhost]

TASK [Upload file to Azure Blob] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

**An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named ‘azure.cli’**

fatal: [localhost]: FAILED! =\> {“changed”: false, “msg”: “Failed to import the required Python library (ansible[azure] (azure \>= 2.0.0)) on c08393297018’s Python /usr/local/bin/python. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible\_python\_interpreter”}

---

<div class="post-metadata">

**Author:** ![mayank\_gupta](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mayank_gupta/32/2995_2.png) [@mayank\_gupta](https://forum.ansible.com/u/mayank_gupta)\
**Post date:** [September 7, 2024, 10:35am UTC](https://forum.ansible.com/t/azure-azcollection-2-6-0-still-using-az-cli-to-authenticate-even-when-using-service-principal-way-of-doing-it/8294/7 "2024-09-07T10:35:41Z")

</div>

Hi @dnmvisser  
Thanks for the reply.  
My oppologies for the confusion here.  
While capturing the details by mistake took Screen shots from two different conatiners but they were both spinned up with same image.  
However i am attaching the details again as the problem is still persisting.

**autotron@c08393297018:~$ ansible-galaxy collection list**

# /usr/local/lib/python3.9/site-packages/ansible\_collections

Collection Version

* * *

amazon.aws 6.5.0  
ansible.netcommon 5.2.0  
ansible.posix 1.5.4  
ansible.utils 2.11.0  
ansible.windows 1.14.0  
arista.eos 6.1.2  
awx.awx 22.7.0  
**azure.azcollection 2.6.0**

**autotron@c08393297018:~$ ansible-playbook test.yml**

**[WARNING]: No inventory was parsed, only implicit localhost is available**

**[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’**

PLAY [Upload file to Azure Blob] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

ok: [localhost]

TASK [Upload file to Azure Blob] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

**An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named ‘azure.cli’**

fatal: [localhost]: FAILED! =\> {“changed”: false, “msg”: “Failed to import the required Python library (ansible[azure] (azure \>= 2.0.0)) on c08393297018’s Python /usr/local/bin/python. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible\_python\_interpreter”}

---

<div class="post-metadata">

**Author:** ![shertel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/shertel/32/1241_2.png) [@shertel](https://forum.ansible.com/u/shertel)\
**Post date:** [September 10, 2024, 12:25pm UTC](https://forum.ansible.com/t/azure-azcollection-2-6-0-still-using-az-cli-to-authenticate-even-when-using-service-principal-way-of-doing-it/8294/9 "2024-09-10T12:25:25Z")

</div>

> **An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named ‘azure.cli’**

I see azure-cli-core in the Python requirements for the collection [azure/requirements.txt at v2.6.0 · ansible-collections/azure · GitHub](https://github.com/ansible-collections/azure/blob/v2.6.0/requirements.txt#L5). All of the requirements need to be installed on the remote host. It looks like `/usr/local/bin/python` is the Python executable Ansible is using on the remote, so you’ll need to install the requirements to the same Python: `/usr/local/bin/python -m pip install ...`.
