Moving a Secret to a Different Compartment
Move a secret in a vault to a different compartment.
- Open the navigation menu, click Identity & Security, and then click Vault.
- Under List scope, select a compartment that contains the secret that you want to move.
- Click the name of the vault to open its details page.
- Under Resources, click Secrets.
- Find the secret in the list, click the and then select Move resource.
- In the Move resource dialog box, select the destination compartment.
- Click Move Resource.
- 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.