Azure-Samples / ansible-playbooks

Ansible Playbook Samples for Azure
MIT License
224 stars 349 forks source link

Unable to create azure service principal using ansible #87

Open anikm1987 opened 3 years ago

anikm1987 commented 3 years ago

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ X] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Below ansible file I have used to create service principal and setting the password. I am getting error


Any log messages given by the failure

Command to execute - ansible-playbook test.yml --extra-vars "subscription_id="

The full traceback is: File "/tmp/ansible_azure.azcollection.azure_rm_adserviceprincipal_payload_jo7iajtw/ansible_azure.azcollection.azure_rm_adserviceprincipal_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_adserviceprincipal.py", line 153, in create_resource File "/home/ubuntu/.local/lib/python3.8/site-packages/azure/graphrbac/operations/service_principals_operations.py", line 87, in create raise models.GraphErrorException(self._deserialize, response) fatal: [localhost]: FAILED! => { "changed": false, "invocation": { "module_args": { "ad_user": null, "adfs_authority_url": null, "api_profile": "latest", "app_id": "123456", "app_role_assignment_required": null, "auth_source": "auto", "cert_validation_mode": null, "client_id": null, "cloud_environment": "AzureCloud", "password": null, "profile": null, "secret": null, "state": "present", "subscription_id": null, "tenant": "" } }, "msg": "Error creating service principle, app id 123456 - Access Token missing or malformed." }

Expected/desired behavior

Service principal should gets created

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Ubuntu

Release: 20.04 Codename: focal

Versions

ansible 2.9.6 python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]

Mention any other details that might be useful


Thanks! We'll be in touch soon.