Moving a Secret to a Different Compartment

Move a secret in a vault to a different compartment.

    1. Open the navigation menu, click Identity & Security, and then click Vault.
    2. Under List scope, select a compartment that contains the secret that you want to move.
    3. Click the name of the vault to open its details page.
    4. Under Resources, click Secrets.
    5. Find the secret in the list, click the Actions menu (Actions Menu) and then select Move resource.
    6. In the Move resource dialog box, select the destination compartment.
    7. Click Move Resource.
    8. If there are alarms monitoring the secret, update the alarms to reference the new compartment. See Update Alarms.
  • Open a command prompt and run oci vault secret change-compartment to move a secret to a different compartment:

    oci vault secret change-compartment --secret-id <target_secret_id> --compartment-id <new_compartment_id>

    For example:

    
    oci vault secret change-compartment --secret-id ocid1.vaultsecret.oc1.iad.exampleaz5qacpqahuecvbjqzql4qmpbrtd7pprafhivcfik6wuitexample --compartment-id ocid1.tenancy.oc1..exampleati4wjo6cvbxq4iusld5lsdneskcfy7lr4a6wfauxuwrwed5b3xea

    For a complete list of parameters and values for CLI commands, see the CLI Command Reference.

  • Run the ChangeSecretCompartment operation to move secret from one compartment to another compartment.

    For information about using the API and signing requests, see REST API documentation and Security Credentials. For information about SDKs, see SDKs and the CLI.