summaryrefslogtreecommitdiffstats
path: root/ansible_collections/azure/azcollection/tests/integration/targets/azure_rm_adserviceprincipal/tasks/main.yml
blob: a861afb7b14a026f51dd037a489adb6666acc075 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
- name: Set variables
  ansible.builtin.set_fact:
    app_id: "e0a62513-1d81-480e-a6dc-5c99cdd58d9a"

- name: Delete ad service principal
  azure_rm_adserviceprincipal:
    app_id: "{{ app_id }}"
    state: absent

- name: Create ad service principal
  azure_rm_adserviceprincipal:
    app_id: "{{ app_id }}"
    state: present
  register: ad_fact

- name: Assert the ad service prinicipal created
  ansible.builtin.assert:
    that:
      - ad_fact.changed

- name: Create ad service principal (idempontent)
  azure_rm_adserviceprincipal:
    app_id: "{{ app_id }}"
    state: present
  register: output

- name: Assert the ad service principal idempotent
  ansible.builtin.assert:
    that:
      - not output.changed

- name: Get ad service principal info by app_id
  azure_rm_adserviceprincipal_info:
    app_id: "{{ app_id }}"
  register: ad_info

- name: Assert The ad service principals facts
  ansible.builtin.assert:
    that:
      - ad_info.service_principals[0].app_display_name == ad_fact.app_display_name
      - ad_info.service_principals[0].app_role_assignment_required == False

- name: Update ad service principal app_role_assignmentrequired to True
  azure_rm_adserviceprincipal:
    app_id: "{{ app_id }}"
    app_role_assignment_required: true
    state: present
  register: output

- name: Get ad service principal info by object_id
  azure_rm_adserviceprincipal_info:
    object_id: "{{ ad_info.service_principals[0].object_id }}"
  register: ad_info

- name: Assert the ad service principals facts
  ansible.builtin.assert:
    that:
      - ad_info.service_principals[0].app_display_name == ad_fact.app_display_name
      - ad_info.service_principals[0].app_role_assignment_required == True

- name: Delete ad service principal
  azure_rm_adserviceprincipal:
    app_id: "{{ app_id }}"
    state: absent
  register: output

- name: Assert the ad service principals deleted
  ansible.builtin.assert:
    that:
      - output.changed