DEV Community

Cover image for How to get OCI tenancy OCID from OCI CLI
Faris Durrani
Faris Durrani

Posted on

How to get OCI tenancy OCID from OCI CLI

How to retrieve the Oracle Cloud tenancy OCID using the OCI CLI

oci iam compartment list --query 'data[?contains("compartment-id", `.tenancy`)]."compartment-id" | [0]' --raw-output --profile DEFAULT
Enter fullscreen mode Exit fullscreen mode

Bash screenshot

Safe harbor statement

The information provided on this channel/article/story is solely intended for informational purposes and cannot be used as a part of any contractual agreement. The content does not guarantee the delivery of any material, code, or functionality, and should not be the sole basis for making purchasing decisions. The postings on this site are my own and do not necessarily reflect the views or work of Oracle or Mythics, LLC.

This work is licensed under a Creative Commons Attribution 4.0 International License.

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.