# Having azure.azcollection 2.6.0 installed and using service principle auth but still using azure cli dependency

**URL:** <https://forum.ansible.com/t/having-azure-azcollection-2-6-0-installed-and-using-service-principle-auth-but-still-using-azure-cli-dependency/8313>\
**Category:** Get Help\
**Tags:** azure, windows, awx, aws, galaxy-ng\
**Created:** [September 7, 2024, 11:55am UTC](https://forum.ansible.com/t/having-azure-azcollection-2-6-0-installed-and-using-service-principle-auth-but-still-using-azure-cli-dependency/8313 "2024-09-07T11:55:49Z")\
**Posts on this page:** 1\
**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 7, 2024, 11:55am UTC](https://forum.ansible.com/t/having-azure-azcollection-2-6-0-installed-and-using-service-principle-auth-but-still-using-azure-cli-dependency/8313/1 "2024-09-07T11:55:49Z")

</div>

## We are trying to make a azure blob connection using azure.azcollection.azure\_rm\_storageblob package in ansibel. Below is the ansible playbook.

- name: Upload file to Azure Blob  
hosts: localhost  
tasks:
  - name: Upload 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: “nonprodsre}”  
resource\_group: “rgsremgmtdev”  
container: “autotron-action”  
blob: “fsdfsfsfd”  
src: “./test.yml”  
state: present  
and exported export azure\_tenant=“xxxx”  
export azure\_subscription\_id=“xxxxxx”  
export azure\_client\_id=“xxxxxxx”  
export azure\_secret=“xxxxxxx”

**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”}

AS PER DOCUMENTATION if using azure.azcollection 2.6.0. IT should not use azure cli to authenticate if passing env var for service priciple authentiocayion.
