Identity Domains Queries
Summary
These are some OCI queries that I use for the identity-domains
API.
References
Get Domain URL
All identity-domains
API calls require the --endpoint
parameter.
See the following screenshot for getting the endpoint from the Domain URL:
)
Show Current User
The following query shows the user name of the currently connected user:
oci identity-domains me get \
--query 'data."user-name"' \
--endpoint https://idcs-effc203d99de4fbf82836e80f9b26ea4.identity.oraclecloud.com:443
The sample output is:
"tenancy_admin"
Note: The brevity of the command is enabled by settings described in “Install OCI CLI”.
List Users in Default Domain
The following query will list all users in the default domain:
oci identity-domains users list \
--query 'data.resources[*].["display-name","nick-name","compartment-ocid"]' \
--endpoint https://idcs-effc203d99de4fbf82836e80f9b26ea4.identity.oraclecloud.com:443
The sample output is:
[
[
"Douglas Hawthorne",
"TAS_TENANT_ADMIN_USER",
"ocid1.tenancy.oc1..aaaaaaaa7ilqdzmkbqduujc3tt6zrl2n2ytcughcjoidozg4memj2k4cm7na"
],
[
"Me",
null,
"ocid1.tenancy.oc1..aaaaaaaa7ilqdzmkbqduujc3tt6zrl2n2ytcughcjoidozg4memj2k4cm7na"
]
]
To get tabular output, run the following query:
oci identity-domains users list \
--query 'data.resources[*].{"Display Name": "display-name", "Nick-name": "nick-name", "Compartment OCID": "compartment-ocid"}' \
--output table \
--endpoint https://idcs-effc203d99de4fbf82836e80f9b26ea4.identity.oraclecloud.com:443
The sample output is:
+---------------------------------------------------------------------------------+-------------------+-----------------------+
| Compartment OCID | Display Name | Nick-name |
+---------------------------------------------------------------------------------+-------------------+-----------------------+
| ocid1.tenancy.oc1..aaaaaaaa7ilqdzmkbqduujc3tt6zrl2n2ytcughcjoidozg4memj2k4cm7na | Douglas Hawthorne | TAS_TENANT_ADMIN_USER |
| ocid1.tenancy.oc1..aaaaaaaa7ilqdzmkbqduujc3tt6zrl2n2ytcughcjoidozg4memj2k4cm7na | Me | None |
+---------------------------------------------------------------------------------+-------------------+-----------------------+
opc-total-items: 2
To get all of the returned data, run the following query:
oci identity-domains users list \
--endpoint https://idcs-effc203d99de4fbf82836e80f9b26ea4.identity.oraclecloud.com:443 \
>users-list.json
The full output has been uploaded as users-list.json.