3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

OCI CLIで子テナンシーの一覧を確認する

Last updated at Posted at 2024-08-08

はじめに

OCIの子テナンシーの一覧をCLIで確認する方法です

以降は親テナンシーで実施します。

organization OCIDの確認

oci organizations organization list --compartment-id ocid1.tenancy.oc1..aaaaaaaacueyrcxxxxxxxxxxxxxxxxxx
{
  "data": {
    "items": [
      {
        ・・・
        "id": "ocid1.organizationsentity.oc1.ap-tokyo-1.amaaaaaaad4rljyabqrzc33axxxxxxxxxxxxxxxxx",
        ・・・
      }
    ]
  }

子テナンシーの一覧表示

確認したorganization OCIDを環境変数に設定してから表示します。

export ID=ocid1.organizationsentity.oc1.ap-tokyo-1.amaaaaaaad4rljyabqrzcxxxxxxxxxxxxxxxx
oci organizations organization list-organization-tenancies --all --organization-id $ID --query data.items[].name
[
  "aaaaaaa",
  "bbbbbbbbb",
]

テーブル形式

oci organizations organization list-organization-tenancies --output table --all --organization-id $ID --query data.items[].name
+---------------------------+
| Column1                   |
+---------------------------+
| aaaaaaaaaaaaaaaaaaa       |
| bbbbbbbbbbbbbbbbbbbbb     |
+---------------------------+

テナンシー名とOCIDを表示する

$ oci organizations organization list-organization-tenancies --all --organization-id $ID --query "data.items[].{NAME:\"name\", OCID:\"tenancy-id\"}" --output table
+---------------------------+---------------------------------------------------------------------------------+
| NAME                      | OCID                                                                            |
+---------------------------+---------------------------------------------------------------------------------+
| xxxxxxxxxxxxxxxxxx        | ocid1.tenancy.oc1..aaaaaaaaxxxxxxx |
| xxxxxxxxxxxxxxxxxxxxx     | ocid1.tenancy.oc1..aaaaaaaaxxxxxxx |
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?