users
Creates, updates, deletes, gets or lists a users resource.
Overview​
| Name | users |
| Type | Resource |
| Id | oci.identity.users |
Fields​
The following fields are returned by SELECT queries:
- get
- list
The user was retrieved.
| Name | Datatype | Description |
|---|---|---|
id | string | The OCID of the user. |
name | string | The name you assign to the user during creation. This is the user's login for the Console. The name must be unique across all users in the tenancy and cannot be changed. |
capabilities | object | Properties indicating how the user is allowed to authenticate. |
compartmentId | string | The OCID of the tenancy containing the user. |
dbUserName | string | DB username of the DB credential. Has to be unique across the tenancy. |
definedTags | object | Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](/Content/General/Concepts/resourcetags.htm). Example: {"Operations": {"CostCenter": "42"}} |
description | string | The description you assign to the user. Does not have to be unique, and it's changeable. (For tenancies that support identity domains) You can have an empty description. |
email | string | The email address you assign to the user. The email address must be unique across all users in the tenancy. (For tenancies that support identity domains) The email address is required unless the requirement is disabled at the tenancy level. |
emailVerified | boolean | Whether the email address has been validated. |
externalIdentifier | string | Identifier of the user in the identity provider |
freeformTags | object | Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](/Content/General/Concepts/resourcetags.htm). Example: {"Department": "Finance"} |
identityProviderId | string | The OCID of the IdentityProvider this user belongs to. |
inactiveStatus | integer (int64) | Returned only if the user's lifecycleState is INACTIVE. A 16-bit value showing the reason why the user is inactive: - bit 0: SUSPENDED (reserved for future use) - bit 1: DISABLED (reserved for future use) - bit 2: BLOCKED (the user has exceeded the maximum number of failed login attempts for the Console) |
isMfaActivated | boolean | Flag indicates if MFA has been activated for the user. |
lastSuccessfulLoginTime | string (date-time) | The date and time of when the user most recently logged in the format defined by RFC3339 (ex. 2016-08-25T21:10:29.600Z). If there is no login history, this field is null. For illustrative purposes, suppose we have a user who has logged in at July 1st, 2020 at 1200 PST and logged out 30 minutes later. They then login again on July 2nd, 2020 at 1500 PST. Their previousSuccessfulLoginTime would be 2020-07-01:19:00.000Z. Their lastSuccessfulLoginTime would be 2020-07-02:22:00.000Z. |
lifecycleState | string | The user's current state. After creating a user, make sure its lifecycleState changes from CREATING to ACTIVE before using it. (CREATING, ACTIVE, INACTIVE, DELETING, DELETED) |
previousSuccessfulLoginTime | string (date-time) | The date and time of when the user most recently logged in the format defined by RFC3339 (ex. 2016-08-25T21:10:29.600Z). If there is no login history, this field is null. For illustrative purposes, suppose we have a user who has logged in at July 1st, 2020 at 1200 PST and logged out 30 minutes later. They then login again on July 2nd, 2020 at 1500 PST. Their previousSuccessfulLoginTime would be 2020-07-01:19:00.000Z. Their lastSuccessfulLoginTime would be 2020-07-02:22:00.000Z. |
timeCreated | string (date-time) | Date and time the user was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z |
An individual employee or system that needs to manage or use your company's Oracle Cloud Infrastructure<br />resources. Users might need to launch instances, manage remote disks, work with your cloud network, etc. Users<br />have one or more IAM Service credentials ([ApiKey](#/en/identity/20160918/ApiKey/),<br />[UIPassword](#/en/identity/20160918/UIPassword/), [SwiftPassword](#/en/identity/20160918/SwiftPassword/) and<br />[AuthToken](#/en/identity/20160918/AuthToken/)).<br />For more information, see [User Credentials](/Content/Identity/usercred/usercredentials.htm)). End users of your<br />application are not typically IAM Service users, but for tenancies that have identity domains, they might be.<br />For conceptual information about users and other IAM Service components, see [Overview of IAM](/Content/Identity/getstarted/identity-domains.htm).<br /><br />These users are created directly within the Oracle Cloud Infrastructure system, via the IAM service.<br />They are different from federated users, who authenticate themselves to the Oracle Cloud Infrastructure<br />Console via an identity provider. For more information, see<br />[Identity Providers and Federation](/Content/Identity/Concepts/federation.htm).<br /><br />To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized,<br />talk to an administrator. If you're an administrator who needs to write policies to give users access,<br />see [Get Started with Policies](/Content/Identity/policiesgs/get-started-with-policies.htm).<br /><br />Warning: Oracle recommends that you avoid using any confidential information when you supply string values<br />using the API.<br />
| Name | Datatype | Description |
|---|---|---|
id | string | The OCID of the user. |
name | string | The name you assign to the user during creation. This is the user's login for the Console. The name must be unique across all users in the tenancy and cannot be changed. |
capabilities | object | Properties indicating how the user is allowed to authenticate. |
compartmentId | string | The OCID of the tenancy containing the user. |
dbUserName | string | DB username of the DB credential. Has to be unique across the tenancy. |
definedTags | object | Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](/Content/General/Concepts/resourcetags.htm). Example: {"Operations": {"CostCenter": "42"}} |
description | string | The description you assign to the user. Does not have to be unique, and it's changeable. (For tenancies that support identity domains) You can have an empty description. |
email | string | The email address you assign to the user. The email address must be unique across all users in the tenancy. (For tenancies that support identity domains) The email address is required unless the requirement is disabled at the tenancy level. |
emailVerified | boolean | Whether the email address has been validated. |
externalIdentifier | string | Identifier of the user in the identity provider |
freeformTags | object | Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](/Content/General/Concepts/resourcetags.htm). Example: {"Department": "Finance"} |
identityProviderId | string | The OCID of the IdentityProvider this user belongs to. |
inactiveStatus | integer (int64) | Returned only if the user's lifecycleState is INACTIVE. A 16-bit value showing the reason why the user is inactive: - bit 0: SUSPENDED (reserved for future use) - bit 1: DISABLED (reserved for future use) - bit 2: BLOCKED (the user has exceeded the maximum number of failed login attempts for the Console) |
isMfaActivated | boolean | Flag indicates if MFA has been activated for the user. |
lastSuccessfulLoginTime | string (date-time) | The date and time of when the user most recently logged in the format defined by RFC3339 (ex. 2016-08-25T21:10:29.600Z). If there is no login history, this field is null. For illustrative purposes, suppose we have a user who has logged in at July 1st, 2020 at 1200 PST and logged out 30 minutes later. They then login again on July 2nd, 2020 at 1500 PST. Their previousSuccessfulLoginTime would be 2020-07-01:19:00.000Z. Their lastSuccessfulLoginTime would be 2020-07-02:22:00.000Z. |
lifecycleState | string | The user's current state. After creating a user, make sure its lifecycleState changes from CREATING to ACTIVE before using it. (CREATING, ACTIVE, INACTIVE, DELETING, DELETED) |
previousSuccessfulLoginTime | string (date-time) | The date and time of when the user most recently logged in the format defined by RFC3339 (ex. 2016-08-25T21:10:29.600Z). If there is no login history, this field is null. For illustrative purposes, suppose we have a user who has logged in at July 1st, 2020 at 1200 PST and logged out 30 minutes later. They then login again on July 2nd, 2020 at 1500 PST. Their previousSuccessfulLoginTime would be 2020-07-01:19:00.000Z. Their lastSuccessfulLoginTime would be 2020-07-02:22:00.000Z. |
timeCreated | string (date-time) | Date and time the user was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | userId, region | Gets the specified user's information. | |
list | select | compartmentId, region | page, limit, identityProviderId, externalIdentifier, name, sortBy, sortOrder, lifecycleState | Lists the users in your tenancy. You must specify your tenancy's OCID as the value for the<br />compartment ID (remember that the tenancy is simply the root compartment).<br />See [Where to Get the Tenancy's OCID and User's OCID](/Content/API/Concepts/apisigningkey.htm#five).<br /> |
create | insert | region, name, compartmentId, description | opc-retry-token | Creates a new user in your tenancy. For conceptual information about users, your tenancy, and other<br />IAM Service components, see [Overview of IAM](/Content/Identity/getstarted/identity-domains.htm).<br /><br />You must specify your tenancy's OCID as the compartment ID in the request object (remember that the<br />tenancy is simply the root compartment). Notice that IAM resources (users, groups, compartments, and<br />some policies) reside within the tenancy itself, unlike cloud resources such as compute instances,<br />which typically reside within compartments inside the tenancy. For information about OCIDs, see<br />[Resource Identifiers](/Content/General/Concepts/identifiers.htm).<br /><br />You must also specify a name for the user, which must be unique across all users in your tenancy<br />and cannot be changed. Allowed characters: No spaces. Only letters, numerals, hyphens, periods,<br />underscores, +, and @. If you specify a name that's already in use, you'll get a 409 error.<br />This name will be the user's login to the Console. You might want to pick a<br />name that your company's own identity system (e.g., Active Directory, LDAP, etc.) already uses.<br />If you delete a user and then create a new user with the same name, they'll be considered different<br />users because they have different OCIDs.<br /><br />You must also specify a description for the user (although it can be an empty string).<br />It does not have to be unique, and you can change it anytime with<br />[UpdateUser](#/en/identity/20160918/User/UpdateUser). You can use the field to provide the user's<br />full name, a description, a nickname, or other information to generally identify the user.<br /><br />After you send your request, the new object's lifecycleState will temporarily be CREATING. Before<br />using the object, first make sure its lifecycleState has changed to ACTIVE.<br /><br />A new user has no permissions until you place the user in one or more groups (see<br />[AddUserToGroup](#/en/identity/20160918/UserGroupMembership/AddUserToGroup)). If the user needs to<br />access the Console, you need to provide the user a password (see<br />[CreateOrResetUIPassword](#/en/identity/20160918/UIPassword/CreateOrResetUIPassword)).<br />If the user needs to access the Oracle Cloud Infrastructure REST API, you need to upload a<br />public API signing key for that user (see<br />[Required Keys and OCIDs](/Content/API/Concepts/apisigningkey.htm) and also<br />[UploadApiKey](#/en/identity/20160918/ApiKey/UploadApiKey)).<br /><br />Important: Make sure to inform the new user which compartment(s) they have access to.<br /> |
update | update | userId, region | if-match | Updates the description of the specified user. |
delete | delete | userId, region | if-match | Deletes the specified user. The user must not be in any groups. |
Parameters​
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
compartmentId | string | The OCID of the compartment (remember that the tenancy is simply the root compartment). |
region | string | OCI region identifier (e.g. us-ashburn-1, ap-sydney-1); resolves from OCI_REGION when not supplied in the query. (default: us-ashburn-1, x-stackQL-envVar: OCI_REGION) |
userId | string | The OCID of the user. |
externalIdentifier | string | The id of a user in the identity provider. |
identityProviderId | string | The id of the identity provider. |
if-match | string | For optimistic concurrency control. In the PUT or DELETE call for a resource, set the if-match parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value. |
lifecycleState | string | A filter to only return resources that match the given lifecycle state. The state value is case-insensitive. |
limit | integer | The maximum number of items to return in a paginated "List" call. |
name | string | A filter to only return resources that match the given name exactly. |
opc-retry-token | string | A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (e.g., if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected). |
page | string | The value of the opc-next-page response header from the previous "List" call. |
sortBy | string | The field to sort by. You can provide one sort order (sortOrder). Default order for TIMECREATED is descending. Default order for NAME is ascending. The NAME sort order is case sensitive. Note: In general, some "List" operations (for example, ListInstances) let you optionally filter by Availability Domain if the scope of the resource type is within a single Availability Domain. If you call one of these "List" operations without specifying an Availability Domain, the resources are grouped by Availability Domain, then sorted. |
sortOrder | string | The sort order to use, either ascending (ASC) or descending (DESC). The NAME sort order is case sensitive. |
SELECT examples​
- get
- list
Gets the specified user's information.
SELECT
id,
name,
capabilities,
compartmentId,
dbUserName,
definedTags,
description,
email,
emailVerified,
externalIdentifier,
freeformTags,
identityProviderId,
inactiveStatus,
isMfaActivated,
lastSuccessfulLoginTime,
lifecycleState,
previousSuccessfulLoginTime,
timeCreated
FROM oci.identity.users
WHERE userId = '{{ userId }}' -- required
AND region = '{{ region }}' -- required
;
Lists the users in your tenancy. You must specify your tenancy's OCID as the value for the<br />compartment ID (remember that the tenancy is simply the root compartment).<br />See [Where to Get the Tenancy's OCID and User's OCID](/Content/API/Concepts/apisigningkey.htm#five).<br />
SELECT
id,
name,
capabilities,
compartmentId,
dbUserName,
definedTags,
description,
email,
emailVerified,
externalIdentifier,
freeformTags,
identityProviderId,
inactiveStatus,
isMfaActivated,
lastSuccessfulLoginTime,
lifecycleState,
previousSuccessfulLoginTime,
timeCreated
FROM oci.identity.users
WHERE compartmentId = '{{ compartmentId }}' -- required
AND region = '{{ region }}' -- required
AND page = '{{ page }}'
AND limit = '{{ limit }}'
AND identityProviderId = '{{ identityProviderId }}'
AND externalIdentifier = '{{ externalIdentifier }}'
AND name = '{{ name }}'
AND sortBy = '{{ sortBy }}'
AND sortOrder = '{{ sortOrder }}'
AND lifecycleState = '{{ lifecycleState }}'
;
INSERT examples​
- create
- Manifest
Creates a new user in your tenancy. For conceptual information about users, your tenancy, and other<br />IAM Service components, see [Overview of IAM](/Content/Identity/getstarted/identity-domains.htm).<br /><br />You must specify your tenancy's OCID as the compartment ID in the request object (remember that the<br />tenancy is simply the root compartment). Notice that IAM resources (users, groups, compartments, and<br />some policies) reside within the tenancy itself, unlike cloud resources such as compute instances,<br />which typically reside within compartments inside the tenancy. For information about OCIDs, see<br />[Resource Identifiers](/Content/General/Concepts/identifiers.htm).<br /><br />You must also specify a name for the user, which must be unique across all users in your tenancy<br />and cannot be changed. Allowed characters: No spaces. Only letters, numerals, hyphens, periods,<br />underscores, +, and @. If you specify a name that's already in use, you'll get a 409 error.<br />This name will be the user's login to the Console. You might want to pick a<br />name that your company's own identity system (e.g., Active Directory, LDAP, etc.) already uses.<br />If you delete a user and then create a new user with the same name, they'll be considered different<br />users because they have different OCIDs.<br /><br />You must also specify a description for the user (although it can be an empty string).<br />It does not have to be unique, and you can change it anytime with<br />[UpdateUser](#/en/identity/20160918/User/UpdateUser). You can use the field to provide the user's<br />full name, a description, a nickname, or other information to generally identify the user.<br /><br />After you send your request, the new object's lifecycleState will temporarily be CREATING. Before<br />using the object, first make sure its lifecycleState has changed to ACTIVE.<br /><br />A new user has no permissions until you place the user in one or more groups (see<br />[AddUserToGroup](#/en/identity/20160918/UserGroupMembership/AddUserToGroup)). If the user needs to<br />access the Console, you need to provide the user a password (see<br />[CreateOrResetUIPassword](#/en/identity/20160918/UIPassword/CreateOrResetUIPassword)).<br />If the user needs to access the Oracle Cloud Infrastructure REST API, you need to upload a<br />public API signing key for that user (see<br />[Required Keys and OCIDs](/Content/API/Concepts/apisigningkey.htm) and also<br />[UploadApiKey](#/en/identity/20160918/ApiKey/UploadApiKey)).<br /><br />Important: Make sure to inform the new user which compartment(s) they have access to.<br />
INSERT INTO oci.identity.users (
compartmentId,
definedTags,
description,
email,
freeformTags,
name,
region,
opc-retry-token
)
SELECT
'{{ compartmentId }}' /* required */,
'{{ definedTags }}',
'{{ description }}' /* required */,
'{{ email }}',
'{{ freeformTags }}',
'{{ name }}' /* required */,
'{{ region }}',
'{{ opc-retry-token }}'
RETURNING
id,
name,
capabilities,
compartmentId,
dbUserName,
definedTags,
description,
email,
emailVerified,
externalIdentifier,
freeformTags,
identityProviderId,
inactiveStatus,
isMfaActivated,
lastSuccessfulLoginTime,
lifecycleState,
previousSuccessfulLoginTime,
timeCreated
;
# Description fields are for documentation purposes
- name: users
props:
- name: region
value: "{{ region }}"
description: Required parameter for the users resource.
- name: compartmentId
value: "{{ compartmentId }}"
description: |
The OCID of the tenancy containing the user.
- name: definedTags
value: "{{ definedTags }}"
description: |
Defined tags for this resource. Each key is predefined and scoped to a namespace.
For more information, see [Resource Tags](/Content/General/Concepts/resourcetags.htm).
Example: `{"Operations": {"CostCenter": "42"}}`
- name: description
value: "{{ description }}"
description: |
The description you assign to the user during creation. Does not have to be unique, and it's changeable.
(For tenancies that support identity domains) You can have an empty description.
- name: email
value: "{{ email }}"
description: |
The email you assign to the user during creation. The email must be unique across all users in the tenancy.
(For tenancies that support identity domains) You must provide an email for each user.
- name: freeformTags
value: "{{ freeformTags }}"
description: |
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
For more information, see [Resource Tags](/Content/General/Concepts/resourcetags.htm).
Example: `{"Department": "Finance"}`
- name: name
value: "{{ name }}"
description: |
The name you assign to the user during creation. This is the user's login for the Console.
The name must be unique across all users in the tenancy and cannot be changed.
- name: opc-retry-token
value: "{{ opc-retry-token }}"
description: A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (e.g., if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).
description: A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (e.g., if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).
UPDATE examples​
- update
Updates the description of the specified user.
UPDATE oci.identity.users
SET
dbUserName = '{{ dbUserName }}',
definedTags = '{{ definedTags }}',
description = '{{ description }}',
email = '{{ email }}',
freeformTags = '{{ freeformTags }}'
WHERE
userId = '{{ userId }}' --required
AND region = '{{ region }}' --required
AND if-match = '{{ if-match}}'
RETURNING
id,
name,
capabilities,
compartmentId,
dbUserName,
definedTags,
description,
email,
emailVerified,
externalIdentifier,
freeformTags,
identityProviderId,
inactiveStatus,
isMfaActivated,
lastSuccessfulLoginTime,
lifecycleState,
previousSuccessfulLoginTime,
timeCreated;
DELETE examples​
- delete
Deletes the specified user. The user must not be in any groups.
DELETE FROM oci.identity.users
WHERE userId = '{{ userId }}' --required
AND region = '{{ region }}' --required
AND if-match = '{{ if-match }}'
;