OCI Identity Domains with CLI
In this tutorial, you use the Oracle Cloud Infrastructure command line interface (OCI CLI) to create and manage users in an identity domain.
OCI CLI is built on the Oracle Cloud Infrastructure SDK for Python and runs on Mac, Windows, and Linux. The Python code makes requests to OCI APIs to provide the functionality.
The CLI supports several authentication methods. In this tutorial, you use the API key-based authentication method.
This tutorial covers the following tasks:
- Generate an API signing key pair
- Set up the CLI configuration file
- Install the CLI
- Get the identity domain URL
- Create a user
- Get a user's details
- Delete a user
This tutorial takes about 30 minutes to complete.
This tutorial is specific to OCI Identity and Access Management with identity domains.
Before You Begin
To perform this tutorial, you must have the following:
-
A user account with access to an identity domain and assigned the user administrator role. Ask the identity domain administrator or cloud account administrator if you're not sure whether you have the permissions to create and manage users in an identity domain.
-
The
.oci
directory in your user home directory on the local machine:~/.oci
For example, on Windows, you can use PowerShell to create the directory with the following command:
mkdir %HOMEDRIVE%%HOMEPATH%\.oci
-
A supported version of Python on a supported operating system.
If you don't already have Python installed on Windows or Linux, later in this tutorial when you run the CLI installation script to install the CLI, you can let the script install Python for you.
1. Generate an API signing key pair
An RSA key pair in PEM format (minimum 2048 bits) is required for signing API requests.
This task describes how to use the Console to create a key pair.
The following procedure assumes that you have already created the .oci
directory in your user home directory on the local machine. The ~/.oci
directory is required to store OCI configuration information such as signing credentials and OCID values.
2. Set up the CLI Configuration File
The CLI configuration contains the required credentials for working with Oracle Cloud Infrastructure.
This task assumes that you have generated the API key pair for signing API requests.
3. Install the CLI
You can install OCI CLI on Windows, Linux, or MacOS.
Before installing the CLI, ensure that a supported Python version is already installed on the machine. The supported Python versions section lists the versions that are supported for each OS.
Consider the following:
-
If you already have Python installed on the machine, use the
python --version
command in a command prompt to find out which version is installed. -
If you don't already have Python installed or you don't have a compatible Python version, the options are:
-
Install a compatible Python version on the machine before installing the CLI.
-
On Windows or Linux: When you run the CLI installation script, you can let the script install Python for you at the same time.
-
On MacOS: The CLI installation script doesn't install Python for you. You must upgrade before you can proceed with the CLI installation.
-
To install the OCI CLI on a machine:
4. Get the Identity Domain URL
This task assumes that you have an Oracle Cloud user account with access to an identity domain.
5. Create a User
This task assumes that you have generated the API signing key pair, set up the OCI configuration file, and installed the CLI.
You also need to have the identity domain URL to construct CLI commands.
Complex input, such as arrays and objects with more than one value, are passed in JSON format to the CLI. The input can be provided as a JSON file or as inline parameter strings at the command line.
6. Get a User
This task assumes that you have created a user and obtained the user's OCID.
7. Delete a User
Delete a user by providing the user's OCID.
What's Next
Explore more about using the CLI in OCI.