Description
ad_user in azure.azcollection.azure_rm_adserviceprincipal identifies the account Ansible uses to sign in to Azure. app_id identifies the application for which it creates a service principal.
Potential impact
Running the task as the wrong user can cause a permission error or allow changes outside the intended scope.
Remediation
If you use user authentication, set azure_auth_username to an approved existing account. Supply its credentials securely and grant only the permissions the task needs. To configure an Azure SQL administrator, use administrators in the SQL server module.
Examples
Supply the existing application’s app_id and its tenant ID.
Before
yaml
- name: Create the service principal
azure.azcollection.azure_rm_adserviceprincipal:
app_id: "{{ app_id }}"
state: present
tenant: "{{ tenant_id }}"
ad_user: admin
After
yaml
- name: Create the service principal
azure.azcollection.azure_rm_adserviceprincipal:
app_id: "{{ app_id }}"
state: present
tenant: "{{ tenant_id }}"
ad_user: "{{ azure_auth_username }}"