Oracle Cloud username cannot be changed once it is defined from OCI console. Effortlessly manage your Oracle Cloud account by changing usernames using OCI (Oracle Cloud Infrastructure) REST API. Utilize OCI REST API to seamlessly update usernames, ensuring smooth account management and enhanced security in your Oracle Cloud environment. In this article, we will use Oracle provided REST API to change username in Oracle cloud. We will use Postman for API call.
Steps to Change Oracle Cloud Username
Login to Oracle Identity Cloud Service as an admin user and follow the below steps.
In the IDCS Admin Console go to Application->Add:
Select Confidential Application
Enter a name for the app. You can have different apps for different purposes. Each app will have it’s own unique CLIENT_ID and CLIENT_SECRET combination.
Click Next
Select ‘Client Credentials’ and ‘JWT Assertion’ in the Allowed Grant Types:
The grant types define how the IDCS handles authorization:
Client Credentials – This will generate our Client ID and Client Secret
JWT Assertion – this enables the REST client to connect using a JSON web token (JWT)
On the Client page, scroll down to the Grant the client access to Identity Cloud Service Admin APIs. section, and click Add
In the Add App Role dialog box, select the type of access your REST API account needs. We are doing high-level security tasks so we will select Identity Domain Administrator, and then click Add:
Now keep clicking next and Finish
After you click Finish you will see a pop-up box containing your Client ID (think username) and Client Secret (think password). Note this down safely to use when you start making REST API calls.
Finally click Activate to enable the application:
Running Your First IDCS REST API Call in Postman
Open postman and prepare it for first API call. In authorization tab, set Client ID, Client Secret from the APP created in above steps and set the Scope as shown below. Then click generate token to get a new token. Use your IDCS url. We are testing using GET API call to fetch all users list from IDCS
If you get list of users from IDCS, then API is working fine. In order to update a user in IDCS, we need a technical ID mapped to this user. From payload received in Get API call, copy the id of the user as shown below
Call OCI REST API
Now change the above call in postman from GET to Patch and in body of payload use the following code and specify new username. We can also develop a script to change username in Oracle cloud in bulk.
If API call is successful, verify changed username from OCI console. By leveraging the OCI REST API, you can seamlessly change a user’s username within Oracle Cloud Infrastructure. This allows for efficient user management and automation of administrative tasks.