Challenge 1 - Task 1 of 5
Authorize OCI Resources to Retrieve the Secret from the Vault
Scenario:
You are working on a Python program running on a compute instance that needs to access an external service. To access the external service, the program needs credentials (password). Given that it is not a best security practice, you decide not to hard code the credential in the program. Instead, you store the password (secret) in a vault using the OCI Vault service. The requirement now is to authorize the compute instance so that the Python program can retrieve the password (secret) by making an API call to the OCI Vault.

Preconfigured:
To complete this requirement, you are provided with:
An OCI Vault to store the secret required by the program, which is created in the root compartment as PBT_Vault_SP.
An instance principal IAM service, which enables instances to be authorized actors (principals) that can retrieve the secret from the OCI Vault.
A dynamic group named PBT_Dynamic_Group_SP with permissions to access the OCI Vault. This dynamic group includes all of the instances in your compartment.
Access to Cloud Shell.
Permissions to perform only the tasks within the challenge.
Note: You are provided with access to an OCI Tenancy, an assigned compartment, and OCI credentials. Throughout your exam, ensure to use the assigned Compartment 99234021-C01 and Region us-ashburn-1.
Complete the following tasks in the OCI environment provisioned:
Create Master Encryption Key with the name my_pbt_msk with 256 bits shape.
Create a Secret with the name my-pbt-secret_99234021-lab.user01 and secret content.
For example: If your user name is 99346163-lab.user02, then the secret should be named as my-pbt-secret_99346163-lab.user02.
Correct Answer:
See the solution below in Explanation
Explanation:
SOLUTION:
From the navigation menu, select "Identity & Security" and then click "Vault." From the left navigation pane, under "List Scope," select the working compartment from the "Compartment" drop-down menu.
Select "PBT_Vault_SP."
From the left navigation pane under "Resources," click "Master Encryption Keys," and then click "Create Key." On the "Create Key" page, enter the following details:
Create in compartment: <your working compartment>
Protection Mode: HSM
Name: my_pbt_msk
Key Shape: Algorithm (Accept the default values)
Key Shape: Length (256 bits)
Click "Create Key" to save. "It will take about a minute to create the master encryption key. The keys will go through the Creating state to the Active state." From the left navigation pane under "Resources," select "Secrets" and click "Create Secret." On the "Create Secret" page, enter the following details:
Create in compartment: <your working compartment>
Name: my-pbt-secret_99234021-lab.user01
Description: "My application secret key"
Encryption Key: Select the my_pbt_msk key created earlier.
Secret Contents: <Your secret here>
Click "Create Secret."
After the secret is created, click "my-pbt-secret_99234021-lab.user01." Click the "Copy" link located to the right of the Secret Key's OCID value. Later, it will be included in a Python script. "Sample: ocid1.vaultsecret.oc1.iad.XXXXXXXXXXXXXXXXXXXXXXXXXXXX"