# Ansible AWX credential type is not setting environment variables.

**URL:** <https://forum.ansible.com/t/ansible-awx-credential-type-is-not-setting-environment-variables/33764>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [September 8, 2020, 3:26pm UTC](https://forum.ansible.com/t/ansible-awx-credential-type-is-not-setting-environment-variables/33764 "2020-09-08T15:26:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shaurav\_Raj](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@Shaurav\_Raj](https://forum.ansible.com/u/Shaurav_Raj)\
**Post date:** [September 8, 2020, 3:26pm UTC](https://forum.ansible.com/t/ansible-awx-credential-type-is-not-setting-environment-variables/33764/1 "2020-09-08T15:26:26Z")

</div>

I am using ansible AWX with git source as project.  
The credential type I created to set up the environment variables for dynamic inventory that uses the plug in is not setting up the environment variables.

More details here in the [stackoverflow post](https://stackoverflow.com/q/63711159/5972356?stw=2)

Appreciate any help. Don’t know if I am missing anything here.

---

<div class="post-metadata">

**Author:** ![Philip\_Douglass](https://avatars.discourse-cdn.com/v4/letter/p/3be4f8/32.png) [@Philip\_Douglass](https://forum.ansible.com/u/Philip_Douglass)\
**Post date:** [September 26, 2020, 4:33pm UTC](https://forum.ansible.com/t/ansible-awx-credential-type-is-not-setting-environment-variables/33764/2 "2020-09-26T16:33:52Z")

</div>

Reposting [my answer](https://stackoverflow.com/a/64080047/6352287) on StackOverflow here:

Why are you not using the built-in [Microsoft Azure Resource Manager](https://docs.ansible.com/ansible-tower/latest/html/userguide/credentials.html#microsoft-azure-resource-manager) Credential?

But specifically, your error seems to be due to the fact that the azure\_rm inventory plugin is not validating your `inventories/development/hosts.yml`. As stated in the [azure\_rm\_inventory synopsis](https://docs.ansible.com/ansible/latest/collections/azure/azcollection/azure_rm_inventory.html#synopsis):

---

<div class="post-metadata">

**Author:** ![Shaurav\_Raj](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@Shaurav\_Raj](https://forum.ansible.com/u/Shaurav_Raj)\
**Post date:** [September 28, 2020, 2:48pm UTC](https://forum.ansible.com/t/ansible-awx-credential-type-is-not-setting-environment-variables/33764/3 "2020-09-28T14:48:41Z")

</div>

Thank you for the answer Philip, I totally missed the synopsis, your answer was super helpful. It solved my problem.

I am not using the Azure Resource Manager because a lot of inventory definition is maintained as code and those developers don’t have access to AWX instance.  
The number of Azure subscriptions managed is over 300 and increasing.

Using this approach my goal is to be able to access many subscriptions using the same service principal stored in AWX that gets inject into the dynamic inventory.

Thank you for your answer.

---

<div class="post-metadata">

**Author:** ![Philip\_Douglass](https://avatars.discourse-cdn.com/v4/letter/p/3be4f8/32.png) [@Philip\_Douglass](https://forum.ansible.com/u/Philip_Douglass)\
**Post date:** [September 30, 2020, 3:23pm UTC](https://forum.ansible.com/t/ansible-awx-credential-type-is-not-setting-environment-variables/33764/4 "2020-09-30T15:23:36Z")

</div>

As far as I understand it, there’s no incompatibility here. Even though the built-in credential type requires a subscription id, that doesn’t stop you from accessing many subscriptions. That just depends on how you set up the Service Principle in Azure, right? Your custom credential type supplies a subscription id too, so I don’t see any difference between using your custom one and the built-in one. Your issue has more to do with the inventory plugin config side of things. But as long as you are happy with how it’s working now, no worries, and glad I could help.
