### Example Response: List All Buckets Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-tutorial-access-storage-bucket This is an example of the XML response you might receive when listing buckets in your Cloud Object Storage instance. ```xml cccbd89c-6eb0-4aed-8ffb-899d39bc022e cccbd89c-6eb0-4aed-8ffb-899d39bc022e test-secrets-tutorial 2020-12-14T21:40:55.739Z ``` -------------------------------- ### Example Response: Object Content Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-tutorial-access-storage-bucket This is an example of the content you would receive when reading an object from your Cloud Object Storage bucket. ```text A quick brown fox jumps over the lazy dog. ``` -------------------------------- ### Example of Creating a Notification Registration Source: https://cloud.ibm.com/docs/secrets-manager?interface=ui&topic=secrets-manager-secrets-manager-cli This example demonstrates how to create a notification registration with specific Event Notifications instance CRN, source name, and an optional description. ```bash ibmcloud secrets-manager notifications-registration-create --event-notifications-instance-crn crn:v1:bluemix:public:event-notifications:us-south:a/22018f3c34ff4ff193698d15ca316946:578ad1a4-2fd8-4e66-95d5-79a842ba91f8:: --event-notifications-source-name 'My Secrets Manager' --event-notifications-source-description 'Optional description of this source in an Event Notifications instance.' ``` -------------------------------- ### Example of Global Options Usage Source: https://cloud.ibm.com/docs/secrets-manager?interface=ui&topic=secrets-manager-secrets-manager-cli This example demonstrates the global options available for Secrets Manager CLI commands. It is not a valid command itself but shows option syntax. ```bash ibmcloud secrets-manager --instance-id=provide-here-your-smgr-instanceuuid --region=us-south --output=json --jmes-query="[:10]" --service-url="https://myservice.cloud.ibm.com" --quiet ``` -------------------------------- ### Example Response: List Key Names of a Key-Value Secret Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-vault-manage-kv This is an example JSON response when listing the key names of a key-value secret. ```json { "request_id": "a21993df-a4b7-21f1-95a9-c1af7be87d1b", "lease_id": "", "renewable": false, "lease_duration": 0, "data": { "keys": [ "secret1", "secret2" ] }, "wrap_info": null, "warnings": null, "auth": null } ``` -------------------------------- ### Example of Creating Secret Version Locks Source: https://cloud.ibm.com/docs/secrets-manager?interface=ui&topic=secrets-manager-secrets-manager-cli This example demonstrates how to create a lock named 'lock-example-1' on a secret version, with associated attributes and a mode to handle previous locks. ```bash ibmcloud secrets-manager secret-version-locks-bulk-create --secret-id 0b5571f7-21e6-42b7-91c5-3f5ac9793a46 --id eb4cf24d-9cae-424b-945e-159788a5f535 --locks '[{"name": "lock-example-1", "description": "lock for consumer 1", "attributes": {"anyKey": "anyValue"}}]' --mode remove_previous ``` -------------------------------- ### Example Response: Patch a Key-Value Secret Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-vault-manage-kv This is an example JSON response after successfully patching a key-value secret. ```json { "request_id": "9000000d4-f0000-4c000-000000-800000000f", "lease_id": "", "renewable": false, "lease_duration": 0, "data": { "created_time": "2022-02-09T23:41:58.888138788Z", "deletion_time": "", "destroyed": false, "version": 2 }, "wrap_info": null, "warnings": null, "auth": null } ``` -------------------------------- ### Example Secret Version Metadata Output Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-secrets-manager-cli This is an example of the JSON output returned when listing secret versions. It includes details about each version, such as its ID, creation timestamp, and custom metadata. ```json { "versions" : [ { "created_at" : "2022-06-27T11:58:15Z", "created_by" : "iam-ServiceId-e4a2f0a4-3c76-4bef-b1f2-fbeae11c0f21", "expiration_date" : "2030-10-05T11:49:42Z", "id" : "bc656587-8fda-4d05-9ad8-b1de1ec7e712", "payload_available" : true, "secret_group_id" : "67d025e1-0248-418f-83ba-deb0ebfb9b4a", "secret_id" : "67d025e1-0248-418f-83ba-deb0ebfb9b4a", "secret_name" : "example-imported-certificate", "secret_type" : "imported_cert", "serial_number" : "38:eb:01:a3:22:e9:de:55:24:56:9b:14:cb:e2:f3:e3:e2:fb:f5:18", "validity" : { "not_after" : "2030-10-05T11:49:42Z", "not_before" : "2022-06-27T11:58:15Z" }, "version_custom_metadata" : { "custom_version_key" : "custom_version_value" } } ], "total_count" : 1 } ``` -------------------------------- ### Example Output for Listing Secret Version Locks Source: https://cloud.ibm.com/docs/secrets-manager?interface=ui&topic=secrets-manager-secrets-manager-cli This is an example JSON response when listing secret version locks. It shows pagination details and the structure of a lock object. ```json { "first" : { "href" : "https://us-south.secrets-maanger.cloud.ibm.com/88b75b20-aa21-4174-85c9-1feb3cc93c9a/api/v2/secrets/0cf4addb-7a90-410b-a3a7-a15bbe2b7909/versions/7bf3814d-58f8-4df8-9cbd-f6860e4ca973/locks?limit=50" }, "previous" : { "href" : "https://us-south.secrets-maanger.cloud.ibm.com/88b75b20-aa21-4174-85c9-1feb3cc93c9a/api/v2/secrets/0cf4addb-7a90-410b-a3a7-a15bbe2b7909/versions/7bf3814d-58f8-4df8-9cbd-f6860e4ca973/locks?offset=50&limit=50" }, "last" : { "href" : "https://us-south.secrets-maanger.cloud.ibm.com/88b75b20-aa21-4174-85c9-1feb3cc93c9a/api/v2/secrets/0cf4addb-7a90-410b-a3a7-a15bbe2b7909/versions/7bf3814d-58f8-4df8-9cbd-f6860e4ca973/locks?offset=200&limit=50" }, "limit" : 50, "locks" : [ { "attributes" : { "key" : "value" }, "created_at" : "2022-06-27T11:58:15Z", "created_by" : "iam-ServiceId-e4a2f0a4-3c76-4bef-b1f2-fbeae11c0f21", "description" : "lock for consumer 1.", "name" : "lock-example-1", "secret_group_id" : "d8371728-95c8-4c12-b2af-1af98adb9e41", "secret_id" : "0cf4addb-7a90-410b-a3a7-a15bbe2b7909", "secret_version_alias" : "current", "secret_version_id" : "7bf3814d-58f8-4df8-9cbd-f6860e4ca973", "updated_at" : "2022-10-05T21:33:11Z" } ], "next" : { "href" : "https://us-south.secrets-maanger.cloud.ibm.com/88b75b20-aa21-4174-85c9-1feb3cc93c9a/api/v2/secrets/0cf4addb-7a90-410b-a3a7-a15bbe2b7909/versions/7bf3814d-58f8-4df8-9cbd-f6860e4ca973/locks?offset=150&limit=50" }, "offset" : 100, "total_count" : 1 } ``` -------------------------------- ### Example Response for Username and Password Secret Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-vault-api This is an example response when retrieving details of a username and password secret. It includes metadata like name, description, expiration date, and the secret data itself. ```json { "description": "Extended description for my secret.", "expiration_date": "2020-12-31T00:00:00Z", "id": "be4a0846-4cb5-3bfa-bab5-10a44dfc3e85", "labels": [ "dev", "us-south" ], "last_update_date": "2020-12-15T22:46:41Z", "name": "test-username-password-in-group", "secret_data": { "password": "cloudy-rainy-coffee-book", "username": "user123" }, "secret_group_id": "339c026a-ac0f-1ea1-3d43-99adf871b49a", "secret_type": "username_password", "state": 1, "state_description": "Active", "versions": [ { "auto_rotated": false, "created_by": "iam-ServiceId-c0c7cfa4-b24e-4917-ad74-278f2fee5ba0", "creation_date": "2020-12-15T22:46:41Z", "id": "a09c7a3c-13a5-7a17-fadc-e7850496d27a" } ] }, "wrap_info": null, "warnings": null, "auth": null } ``` -------------------------------- ### Example Certificate Authority (CA) Configuration Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-secrets-engines This is a truncated example showing the JSON model for a certificate authority (CA) configuration. The 'name' and 'type' fields identify the configuration, while the 'config' object holds specific details like the private key. ```json { "name": "my-lets-encrypt-config", "type": "letsencrypt", "config": { "private_key": "-----BEGIN PRIVATE KEY-----\nMIICdgIBADANB...(redacted)" } } ``` -------------------------------- ### Update Role Metadata Example Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-vault-cli An example of updating a role's metadata, specifically its name, for IAM credentials in the default group. The output format is set to JSON. ```bash vault write -format=json ibmcloud/iam_credentials/roles/091ca93f-5c99-4078-9d7e-4801143030fd/metadata name="new-credential-name" ``` -------------------------------- ### Retrieve a secret using the CLI by ID Source: https://cloud.ibm.com/docs/secrets-manager?interface=api&topic=secrets-manager-access-secrets Use this command to get the value and metadata of a secret from the CLI. Ensure you have the Secrets Manager CLI plug-in installed. ```bash ibmcloud secrets-manager secret --id SECRET_ID ``` -------------------------------- ### Create Secrets Manager Instance Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-tutorial-kubernetes-secrets Create an instance of the Secrets Manager service with the `trial` plan in the `us-south` region. Provisioning takes 5-15 minutes. ```bash ibmcloud resource service-instance-create my-secrets-manager secrets-manager trial us-south ``` -------------------------------- ### Example Response for Get Lock Details Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-vault-api This JSON object represents the response received when querying for lock details on a specific secret version. It includes information about any locks applied, such as their names, creation dates, and associated metadata. ```json { "request_id": "ba51140d-31a8-0a51-dd5b-1ca59838e881", "lease_id": "", "renewable": false, "lease_duration": 0, "data": { "locks": [ { "attributes": { "key": "value" }, "created_by": "iam-ServiceId-222b47ab-b08e-4619-b68f-8014a2c3acb8", "creation_date": "2022-06-30T21:41:36.616174Z", "description": "Test lock for secret in the default secret group.", "last_update_date": "2022-06-30T21:41:36.616174Z", "name": "lock-for-app-2", "secret_group_id": "default", "secret_id": "184408d6-8264-5ff3-c308-6922ed04ad88", "secret_version_alias": "current", "secret_version_id": "f2b68dbb-c291-87df-6026-7611c324c823" }, { "attributes": { "key": "value" }, "created_by": "iam-ServiceId-222b47ab-b08e-4619-b68f-8014a2c3acb8", "creation_date": "2022-06-30T20:56:33.138337Z", "description": "Test lock for secret in the default secret group.", "last_update_date": "2022-06-30T21:14:14.903163Z", "name": "lock-for-app-1", "secret_group_id": "default", "secret_id": "184408d6-8264-5ff3-c308-6922ed04ad88", "secret_version_alias": "current", "secret_version_id": "f2b68dbb-c291-87df-6026-7611c324c823" } ], "locks_total": 2 }, "wrap_info": null, "warnings": null, "auth": null } ``` -------------------------------- ### Create Secrets Manager Instance Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-tutorial-access-storage-bucket Creates a 'lite' plan instance of Secrets Manager named 'test-sm-instance-tutorial' in the US South region. Provisioning may take 5-15 minutes. ```bash ibmcloud resource service-instance-create test-sm-instance-tutorial secrets-manager lite us-south ``` -------------------------------- ### Create Secret Example Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-secrets-manager-cli An example of how to create a new secret of type 'arbitrary' using the CLI. ```APIDOC ## Create Secret ### Description Creates a new secret in Secrets Manager. ### Command `ibmcloud secrets-manager secret-create` ### Parameters #### Required Parameters - `--secret-name` (string) - The name of the secret. - `--secret-type` (string) - The type of the secret (e.g., `arbitrary`, `username_password`). - `--arbitrary-payload` (string) - The payload for an arbitrary secret. ### Example ``` ibmcloud secrets-manager secret-create --secret-name example-arbitrary-secret --secret-type arbitrary --arbitrary-payload example-secret-data ``` ``` -------------------------------- ### Example SecretGroup Response Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-secrets-manager-cli This is an example of the JSON response received after successfully updating a secret group. ```json { "created_at" : "2020-10-05T21:33:11Z", "description" : "Extended description for this group.", "id" : "d898bb90-82f6-4d61-b5cc-b079b66cfa76", "name" : "my-secret-group", "updated_at" : "2020-11-25T22:13:10Z", "created_by" : "iam-ServiceId-e4a2f0a4-3c76-4bef-b1f2-fbeae11c0f21" } ``` -------------------------------- ### Create Configuration Action with JSON Prototype Source: https://cloud.ibm.com/docs/secrets-manager?interface=ui&topic=secrets-manager-secrets-manager-cli Use this command to create a configuration action using a JSON prototype for the configuration action. ```bash ibmcloud secrets-manager configuration-action-create --name configuration-name --config-action-prototype '{"action_type": "private_cert_configuration_action_rotate_crl"}' --config-type public_cert_configuration_dns_cloud_internet_services ``` -------------------------------- ### Delete Role Example Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-vault-cli Example command for deleting an IAM credentials role from the default group. ```bash vault delete ibmcloud/iam_credentials/roles/091ca93f-5c99-4078-9d7e-4801143030fd ``` -------------------------------- ### Create Cloud Object Storage Instance Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-tutorial-access-storage-bucket Creates a 'lite' plan instance of Cloud Object Storage named 'test-cos-instance-tutorial' in the US South region. ```bash ibmcloud resource service-instance-create test-cos-instance-tutorial cloud-object-storage lite us-south ``` -------------------------------- ### Example Response: All Locks Removed Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-vault-api This is an example response after removing all locks from a secret. It indicates that the 'locks' array is empty. ```json { "request_id": "4708ebbf-eab0-e68a-9e72-d1c67a209fdc", "lease_id": "", "renewable": false, "lease_duration": 0, "data": { "secret_group_id": "default", "secret_id": "184408d6-8264-5ff3-c308-6922ed04ad88", "versions": [ { "alias": "current", "id": "f2b68dbb-c291-87df-6026-7611c324c823", "locks": [], "payload_available": true } ] }, "wrap_info": null, "warnings": null, "auth": null } ``` -------------------------------- ### Create Classic Kubernetes Cluster Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-tutorial-kubernetes-secrets Provision a free classic Kubernetes cluster in the `dal10` zone. Cluster creation can take 5-15 minutes. ```bash ibmcloud ks cluster create classic --zone dal10 --flavor free --name my-test-cluster ``` -------------------------------- ### Example Output of a Vault Command Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-vault-cli This is an example of the JSON output returned by a Vault CLI command, showing details of a secret. ```json { "request_id": "025df8ac-b926-6153-3f5b-cd2364b5f85e", "lease_id": "", "lease_duration": 0, "renewable": false, "data": { "created_by": "iam-ServiceId-b7ebcf90-c7a9-495b-8ce8-bbf33cb95ca0", "creation_date": "2020-10-20T16:55:41Z", "crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/791f5fb10986423e97aa8512f18b7e65:e415e570-f073-423a-abdc-55de9b58f54e:secret:71539dff-9e84-804a-debb-ab3eb3d8afce", "id": "71539dff-9e84-804a-debb-ab3eb3d8afce", "labels": [], "last_update_date": "2020-10-20T16:55:41Z", "name": "my-test-arbitrary-secret", "secret_data": { "payload": "This is the data for my secret." }, "secret_type": "ARBITRARY", "state": 1, "state_description": "Active", "versions": [ { "created_by": "iam-ServiceId-b7ebcf90-c7a9-495b-8ce8-bbf33cb95ca0", "creation_date": "2020-10-20T16:55:41Z", "id": "cc2c795e-0072-8074-9824-b6efd5050232" } ] }, "warnings": null } ``` -------------------------------- ### Vault CLI Command Output Example Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-vault-cli This is an example of the JSON output returned by the Vault CLI after successfully removing locks from a secret. ```json { "request_id": "0ec52cf2-59867-184a9c977", "lease_id": "", "lease_duration": 0, "renewable": false, "data": { "secret_group_id": "default", "secret_id": "65e44d42-cfb6-abe2-637d-2824f4490fa9", "versions": [ { "alias": "current", "id": "6df7edfe-ea85-3d34-565f-0b66caaba832", "locks": [], "payload_available": true } ] }, "warnings": null } ``` -------------------------------- ### Upload Sample File to Cloud Object Storage Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-tutorial-access-storage-bucket Creates and uploads a sample text file named 'sample.txt' to a Cloud Object Storage bucket. ```text A quick brown fox jumped over the lazy dog. ``` -------------------------------- ### Create Network Zone with Secrets Manager (CLI) Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-access-control-cbr Use this command to create a network zone and add the Secrets Manager service to it via the command line. Replace `example-zone-1` and `Example zone 1` as needed. ```bash ibmcloud cbr zone-create --name example-zone-1 --description "Example zone 1" --service-ref service_name=secrets-manager ``` -------------------------------- ### Initialize Terraform CLI Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-terraform-setup Initialize the Terraform CLI in your working directory. This command downloads the necessary provider plugins. ```bash terraform init ``` -------------------------------- ### Example Secret ID Output Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-tutorial-kubernetes-secrets This is an example of the output you might receive after successfully creating a secret, showing the unique ID assigned to it. ```text e0246cea-d668-aba7-eef2-58ca11ad3707 ``` -------------------------------- ### Import certificate and private key using CLI Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-certificates Use the `ibmcloud secrets-manager secret-create` command to import an existing certificate, its private key, and an intermediate certificate. Ensure certificate files are in single-line PEM format for correct parsing. ```bash certificate=$(cat cert.pem) private_key=$(cat key.pem) ibmcloud secrets-manager secret-create --secret-name example-imported-cert-secret --secret-type imported_cert --imported-cert-certificate ${certificate} --imported-cert-private-key ${private_key} ``` -------------------------------- ### Example Response for Updating Secret Metadata Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-vault-api This is an example JSON response received after updating the metadata of an arbitrary secret in the default secret group. ```json { "request_id": "372645c0-9d97-5f6b-0755-99145eacdb93", "lease_id": "", "renewable": false, "lease_duration": 0, "data": { "created_by": "iam-ServiceId-c0c7cfa4-b24e-4917-ad74-278f2fee5ba0", "creation_date": "2021-06-04T02:55:40Z", "crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/a5ebf2570dcaedf18d7ed78e216c263a:0f4c764e-dc3d-44d1-bd60-a2f7cd91e0c0:secret:ea1907c8-8c8e-6b83-3c20-05f2015b80d8", "description": "Updated description for my secret.", "expiration_date": "2030-04-01T09:30:00Z", "id": "ea1907c8-8c8e-6b83-3c20-05f2015b80d8", "labels": [ "dev", "us-south" ], "last_update_date": "2021-06-05T02:55:40Z", "name": "updated-arbitrary-secret", "secret_type": "arbitrary", "state": 1, "state_description": "Active" }, "wrap_info": null, "warnings": null, "auth": null } ``` -------------------------------- ### Get Secret Source: https://cloud.ibm.com/docs/secrets-manager?interface=ui&topic=secrets-manager-secrets-manager-cli Retrieves a secret and its associated details by its ID. Use this command to get the secret data and metadata. For only metadata, use the `secret-metadata` command. ```APIDOC ## ibmcloud secrets-manager secret ### Description Get a secret and its details by specifying the ID of the secret. A successful request returns the secret data that is associated with your secret, along with other metadata. ### Method GET ### Endpoint `ibmcloud secrets-manager secret --id ID` ### Parameters #### Path Parameters - **--id** (string) - Required - The ID of the secret. Must be 36 characters long and match the regex `/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/`. ### Request Example ``` ibmcloud secrets-manager secret --id 0b5571f7-21e6-42b7-91c5-3f5ac9793a46 ``` ``` -------------------------------- ### Example Notification Registration Output Source: https://cloud.ibm.com/docs/secrets-manager?interface=ui&topic=secrets-manager-secrets-manager-cli This JSON output shows the configuration details for a successful notification registration with Event Notifications. ```json { "event_notifications_instance_crn" : "crn:v1:bluemix:public:event-notifications:us-south:a/22018f3c34ff4ff193698d15ca316946:578ad1a4-2fd8-4e66-95d5-79a842ba91f8::" } ``` -------------------------------- ### Create Configuration Action with Granular Options Source: https://cloud.ibm.com/docs/secrets-manager?interface=ui&topic=secrets-manager-secrets-manager-cli Use this command to create a configuration action by specifying granular options for the sub-fields of JSON string options. ```bash ibmcloud secrets-manager configuration-action-create --name configuration-name --config-type public_cert_configuration_dns_cloud_internet_services --config-action-action-type private_cert_configuration_action_rotate_crl ``` -------------------------------- ### Create a Configuration Action Source: https://cloud.ibm.com/docs/secrets-manager?interface=ui&topic=secrets-manager-secrets-manager-cli Create a configuration action for private certificate management. This command supports various actions like signing certificates or rotating CRLs. ```bash ibmcloud secrets-manager configuration-action-create --name NAME [--config-action-prototype CONFIG-ACTION-PROTOTYPE | --config-action-action-type CONFIG-ACTION-ACTION-TYPE --certificate-common-name CERTIFICATE-COMMON-NAME --certificate-alt-names CERTIFICATE-ALT-NAMES --private-cert-ip-sans PRIVATE-CERT-IP-SANS --private-cert-uri-sans PRIVATE-CERT-URI-SANS --private-cert-other-sans PRIVATE-CERT-OTHER-SANS --private-cert-ttl PRIVATE-CERT-TTL --private-cert-format PRIVATE-CERT-FORMAT --private-cert-max-path-length PRIVATE-CERT-MAX-PATH-LENGTH --private-cert-exclude-cn-from-sans=PRIVATE-CERT-EXCLUDE-CN-FROM-SANS --private-cert-permitted-dns-domains PRIVATE-CERT-PERMITTED-DNS-DOMAINS --config-action-use-csr-values=CONFIG-ACTION-USE-CSR-VALUES --private-cert-subject-organizational-unit PRIVATE-CERT-SUBJECT-ORGANIZATIONAL-UNIT --private-cert-subject-organization PRIVATE-CERT-SUBJECT-ORGANIZATION --private-cert-subject-country PRIVATE-CERT-SUBJECT-COUNTRY --private-cert-subject-locality PRIVATE-CERT-SUBJECT-LOCALITY --private-cert-subject-province PRIVATE-CERT-SUBJECT-PROVINCE --private-cert-subject-street-address PRIVATE-CERT-SUBJECT-STREET-ADDRESS --private-cert-subject-postal-code PRIVATE-CERT-SUBJECT-POSTAL-CODE --private-cert-serial-number PRIVATE-CERT-SERIAL-NUMBER --private-cert-csr PRIVATE-CERT-CSR --config-action-intermediate-certificate-authority CONFIG-ACTION-INTERMEDIATE-CERTIFICATE-AUTHORITY --imported-cert-certificate IMPORTED-CERT-CERTIFICATE] [--config-type CONFIG-TYPE] ``` -------------------------------- ### Import SSL/TLS Certificate Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-vault-cli Use this command to import an SSL/TLS certificate and its matching private key. Ensure `cert.pem` and `key.pem` are valid files. ```bash vault write -format=json ibmcloud/imported_cert/secrets name="my-test-imported-certificate" certificate=@cert.pem private_key=@key.pem ``` -------------------------------- ### Full Secret Structure Example Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-what-is-secret This example shows the complete structure of a secret, including common metadata fields and specific fields for a username and password secret. ```json { "name": "my-username-password", "id": "cb123456-8e73-4857-594839587438", "description": "Description for this secret", "secret_type": "username_password", "secret_group_id": "ab654321-3958-9484-1395840384754", "state": 1, "state_description": "Active", "create_by": "iam-ServiceId-gj403948-3048-6059-304958674930", "created_at": "2023-03-08-T20:44:11Z", "labels": [ "dev", "us-south" ], "username": "user123", "password": "cloudy-rainy-coffee-book" } ``` -------------------------------- ### Create Private Certificate Configuration Source: https://cloud.ibm.com/docs/secrets-manager?interface=ui&topic=secrets-manager-secrets-manager-cli Examples of creating a private certificate configuration using the `ibmcloud secrets-manager configuration-create` command with different options. ```APIDOC ## Create Private Certificate Configuration ### Description Creates a private certificate configuration for Secrets Manager. ### Command `ibmcloud secrets-manager configuration-create` ### Example 1: Basic Root CA Configuration ```bash ibmcloud secrets-manager configuration-create --config-type=private_cert_configuration_root_ca --name=example-root-CA --certificate-common-name=example.com --private-cert-max-ttl=7365 ``` ### Example 2: Root CA Configuration with HSM ```bash ibmcloud secrets-manager configuration-create --config-type=private_cert_configuration_root_ca --name=example-root-CA-HSM --certificate-common-name=example.com --private-cert-max-ttl=73654 --private-cert-crypto-key='{ "provider": { "type": "hyper_protect_crypto_services", "instance_crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/791f3fb10486421e97aa8512f18b7e65:b49ad24d-81d4-5ebc-b9b9-b0937d1c84d5::","pin_iam_credentials_secret_id": "14a7aff4-432d-11dc-a0f0-56a5b473394f", "private_keystore_id": "14a7aff4-432d-11dc-a0f0-56a5b473394f" }, "label": "cli-created", "allow_generate_key": true }' ``` ### Example 3: Root CA Configuration with Prototype JSON ```bash ibmcloud secrets-manager configuration-create --configuration-prototype='{"config_type": "private_cert_configuration_root_ca", "name": "example-root-CA", "max_ttl": "43830h", "crl_expiry": "72h", "crl_disable": false, "crl_distribution_points_encoded": true, "issuing_certificates_urls_encoded": true, "common_name": "example.com", "alt_names": ["alt-name-1","alt-name-2"], "ip_sans": "127.0.0.1", "uri_sans": "https://www.example.com/test", "other_sans": ["1.2.3.5.4.3.201.10.4.3;utf8:test@example.com"], "ttl": "2190h", "format": "pem", "private_key_format": "der", "key_type": "rsa", "key_bits": 4096, "max_path_length": -1, "exclude_cn_from_sans": false, "permitted_dns_domains": ["exampleString"], "ou": ["exampleString"], "organization": ["exampleString"], "country": ["exampleString"], "locality": ["exampleString"], "province": ["exampleString"], "street_address": ["exampleString"], "postal_code": ["exampleString"], "serial_number": "d9:be:fe:35:ba:09:42:b5:35:ba:09:42:b5"}' ``` ``` -------------------------------- ### Get Secret Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-secrets-manager-cli Retrieves a secret and its associated details by its ID. This operation returns the secret data and metadata. For only metadata, use the Get secret metadata operation. ```APIDOC ## Get Secret ### Description Retrieves a secret and its associated details by its ID. This operation returns the secret data and metadata. For only metadata, use the Get secret metadata operation. ### Command `ibmcloud secrets-manager secret --id ID` ### Parameters #### Path Parameters - **--id** (string) - Required - The ID of the secret. Must be 36 characters long and match the regex /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/ ### Example ``` ibmcloud secrets-manager secret --id 0b5571f7-21e6-42b7-91c5-3f5ac9793a46 ``` ``` -------------------------------- ### Create a Secret Source: https://cloud.ibm.com/docs/secrets-manager?interface=ui&topic=secrets-manager-secrets-manager-cli Example of how to create an arbitrary secret using the `ibmcloud secrets-manager secret-create` command. ```APIDOC ## Create a Secret ### Description Creates a new secret in your Secrets Manager instance. ### Command ```bash ibmcloud secrets-manager secret-create ``` ### Parameters #### Command options - `--secret-name` (string) - Required - The name of the secret. - `--secret-type` (string) - Required - The type of the secret (e.g., `arbitrary`, `username_password`). - `--arbitrary-payload` (string) - Required for `arbitrary` secret type - The payload of the arbitrary secret. ### Example ```bash ibmcloud secrets-manager secret-create --secret-name example-arbitrary-secret --secret-type arbitrary --arbitrary-payload example-secret-data ``` ``` -------------------------------- ### Example Response: Specific Locks Removed Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-vault-api This is an example response after removing specific locks, showing the remaining locks. The 'locks' array contains the identifiers of the locks that were not removed. ```json { "request_id": "4d954026-68b3-6506-dc1d-5e77574fd2f0", "lease_id": "", "renewable": false, "lease_duration": 0, "data": { "secret_group_id": "default", "secret_id": "184408d6-8264-5ff3-c308-6922ed04ad88", "versions": [ { "alias": "current", "id": "f2b68dbb-c291-87df-6026-7611c324c823", "locks": [ "lock-for-app-1" ], "payload_available": true } ] }, "wrap_info": null, "warnings": null, "auth": null } ``` -------------------------------- ### Sign the intermediate CA Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-intermediate-certificate-authorities This example shows how to sign an intermediate CA that was previously created. This action is typically performed after creating the intermediate CA configuration. ```APIDOC ## POST /api/v2/configurations/{parent_ca_name}/actions ### Description Signs an intermediate certificate authority (CA). ### Method POST ### Endpoint `https://{instance_ID}.{region}.secrets-manager.appdomain.cloud/api/v2/configurations/{parent_ca_name}/actions` ### Parameters #### Path Parameters - **parent_ca_name** (string) - Required - The name of the parent certificate authority to which the intermediate CA is being signed. #### Request Body - **action_type** (string) - Required - The type of action to perform, should be `private_cert_configuration_action_sign_intermediate`. - **intermediate_certificate_authority** (string) - Required - The name of the intermediate certificate authority to sign. ### Request Example ```json { "action_type": "private_cert_configuration_action_sign_intermediate", "intermediate_certificate_authority": "example-intermediate-CA" } ``` ### Response #### Success Response (200) - **message** (string) - A success message indicating the intermediate CA has been signed. #### Response Example ```json { "message": "Intermediate certificate authority 'example-intermediate-CA' signed successfully." } ``` ``` -------------------------------- ### Create Private Certificate Configuration Source: https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-secrets-manager-cli Examples of creating a private certificate configuration using the `ibmcloud secrets-manager configuration-create` command. ```APIDOC ## Create Private Certificate Configuration ### Description Use this command to create a private certificate configuration for your Secrets Manager instance. ### Command `ibmcloud secrets-manager configuration-create` ### Parameters #### Command Options - `--config-type` (string) - Required - The type of configuration to create. For private certificates, use `private_cert_configuration_root_ca`. - `--name` (string) - Required - The name of the configuration. - `--certificate-common-name` (string) - Required - The common name for the certificate. - `--private-cert-max-ttl` (string) - Required - The maximum time-to-live for the certificate in days. - `--private-cert-crypto-key` (string) - Optional - JSON string specifying the crypto key details for HSM integration. - `--configuration-prototype` (string) - Optional - A JSON string defining the full configuration prototype with advanced settings. ### Request Example ```bash ibmcloud secrets-manager configuration-create --config-type=private_cert_configuration_root_ca --name=example-root-CA --certificate-common-name=example.com --private-cert-max-ttl=7365 ibmcloud secrets-manager configuration-create --config-type=private_cert_configuration_root_ca --name=example-root-CA-HSM --certificate-common-name=example.com --private-cert-max-ttl=73654 --private-cert-crypto-key='{ "provider": { "type": "hyper_protect_crypto_services", "instance_crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/791f3fb10486421e97aa8512f18b7e65:b49ad24d-81d4-5ebc-b9b9-b0937d1c84d5::","pin_iam_credentials_secret_id": "14a7aff4-432d-11dc-a0f0-56a5b473394f", "private_keystore_id": "14a7aff4-432d-11dc-a0f0-56a5b473394f" }, "label": "cli-created", "allow_generate_key": true }' ibmcloud secrets-manager configuration-create --configuration-prototype='{"config_type": "private_cert_configuration_root_ca", "name": "example-root-CA", "max_ttl": "43830h", "crl_expiry": "72h", "crl_disable": false, "crl_distribution_points_encoded": true, "issuing_certificates_urls_encoded": true, "common_name": "example.com", "alt_names": ["alt-name-1","alt-name-2"], "ip_sans": "127.0.0.1", "uri_sans": "https://www.example.com/test", "other_sans": ["1.2.3.5.4.3.201.10.4.3;utf8:test@example.com"], "ttl": "2190h", "format": "pem", "private_key_format": "der", "key_type": "rsa", "key_bits": 4096, "max_path_length": -1, "exclude_cn_from_sans": false, "permitted_dns_domains": ["exampleString"], "ou": ["exampleString"], "organization": ["exampleString"], "country": ["exampleString"], "locality": ["exampleString"], "province": ["exampleString"], "street_address": ["exampleString"], "postal_code": ["exampleString"], "serial_number": "d9:be:fe:35:ba:09:42:b5:35:ba:09:42:b5"}' ``` ```