-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateUser.sh
executable file
·47 lines (41 loc) · 1012 Bytes
/
createUser.sh
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
create_user(){
local user_name=$1
echo "Creating a new user with username: $user_name..."
# Store the curl response in a variable
response=$(curl -k -X 'POST' \
'https://localhost:9443/scim2/Users' \
-H 'accept: application/scim+json' \
-H 'Content-Type: application/scim+json' \
-u admin:admin \
-d '{
"schemas": [],
"name": {
"givenName": "Kim",
"familyName": "Berry"
},
"userName": "'$user_name'",
"password": "MyPa33w@rd",
"emails": [
{
"type": "home",
"value": "[email protected]",
"primary": true
},
{
"type": "work",
"value": "[email protected]"
}
],
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
"employeeNumber": "1234A",
"manager": {
"value": "Taylor"
}
}
}')
# Extract the "id" using jq
user_id=$(echo "$response" | jq -r '.id')
# Print the user ID
echo "User ID: $user_id" >> user_id.txt
}
create_user $1