- [ 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
hosts: localhost
connection: local
vars:
azure_app_id: "123456"
tasks:
This issue is for a: (mark with an
x
)Minimal steps to reproduce
Below ansible file I have used to create service principal and setting the password. I am getting error
hosts: localhost connection: local vars: azure_app_id: "123456" tasks:
name: Generate password set_fact: password: "{{ azure_app_id | password_hash('sha512') }}" tenant_id: "{{ lookup('env', 'AZURE_TENANT') }}" azure_client_id: "{{ lookup('env', 'AZURE_CLIENT_ID') }}"
name: Create app Service Principal azure.azcollection.azure_rm_adserviceprincipal: app_id: "{{ azure_app_id }}" state: present tenant: "{{ tenant_id }}" register: azure_output environment: AZURE_SUBSCRIPTION_ID: "{{ subscription_id }}"
name: Set SPN password azure.azcollection.azure_rm_adpassword: app_id: "{{ azure_app_id }}" service_principal_object_id: "{{ azure_output.object_id }}" state: present value: "{{ password }}" environment: AZURE_SUBSCRIPTION_ID: "{{ subscription_id }}"
debug: var: azure_output
Any log messages given by the failure
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?
Ubuntu
Release: 20.04 Codename: focal
Versions
Mention any other details that might be useful