[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-19。"],[],[],null,["# Configure your project's metadata store\n\nVertex ML Metadata lets you track and analyze the metadata\nproduced by your machine learning (ML) workflows. The first time you run a\nPipelineJob or create an experiment in the Vertex SDK, Vertex AI creates\nyour project's\n.\n\nIf you want your metadata encrypted using a [customer-managed encryption key\n(CMEK)](/vertex-ai/docs/general/cmek), you must create your metadata store using a CMEK *before* you use\nVertex ML Metadata to track or analyze metadata.\n\nAfter the metadata store has been created, the CMEK key that the metadata store\nuses is independent of the CMEK key used by processes that log metadata,\nfor example, a pipeline run.\n\nCreate a metadata store that uses a CMEK\n----------------------------------------\n\nUse the following instructions to create a CMEK and set up a\nVertex ML Metadata metadata store that uses this CMEK.\n\n1. [Use Cloud Key Management Service to configure a customer-managed encryption\n key.](/vertex-ai/docs/general/cmek#configure-cmek)\n\n2. Use the following REST call to create your project's default metadata store\n using your CMEK.\n\n\n Before using any of the request data,\n make the following replacements:\n - \u003cvar translate=\"no\"\u003eLOCATION_ID\u003c/var\u003e: Your region.\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your [project ID](/resource-manager/docs/creating-managing-projects#identifiers).\n - \u003cvar translate=\"no\"\u003eKEY_RING\u003c/var\u003e: The name of the Cloud Key Management Service key ring that your encryption key is on.\n - \u003cvar translate=\"no\"\u003eKEY_NAME\u003c/var\u003e: The name of the encryption key that you want to use for this metadata store.\n\n\n HTTP method and URL:\n\n ```\n POST https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/metadataStores?metadata_store_id=default\n ```\n\n\n Request JSON body:\n\n ```\n {\n \"encryption_spec\": {\n \"kms_key_name\": \"projects/PROJECT_ID/locations/LOCATION_ID/keyRings/KEY_RING/cryptoKeys/KEY_NAME\"\n },\n }\n ```\n\n To send your request, expand one of these options:\n\n #### curl (Linux, macOS, or Cloud Shell)\n\n | **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) , or by using [Cloud Shell](/shell/docs), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\n Save the request body in a file named `request.json`.\n Run the following command in the terminal to create or overwrite\n this file in the current directory: \n\n ```\n cat \u003e request.json \u003c\u003c 'EOF'\n {\n \"encryption_spec\": {\n \"kms_key_name\": \"projects/PROJECT_ID/locations/LOCATION_ID/keyRings/KEY_RING/cryptoKeys/KEY_NAME\"\n },\n }\n EOF\n ```\n\n\n Then execute the following command to send your REST request:\n\n ```\n curl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json; charset=utf-8\" \\\n -d @request.json \\\n \"https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/metadataStores?metadata_store_id=default\"\n ```\n\n #### PowerShell (Windows)\n\n | **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\n Save the request body in a file named `request.json`.\n Run the following command in the terminal to create or overwrite\n this file in the current directory: \n\n ```\n @'\n {\n \"encryption_spec\": {\n \"kms_key_name\": \"projects/PROJECT_ID/locations/LOCATION_ID/keyRings/KEY_RING/cryptoKeys/KEY_NAME\"\n },\n }\n '@ | Out-File -FilePath request.json -Encoding utf8\n ```\n\n\n Then execute the following command to send your REST request:\n\n ```\n $cred = gcloud auth print-access-token\n $headers = @{ \"Authorization\" = \"Bearer $cred\" }\n\n Invoke-WebRequest `\n -Method POST `\n -Headers $headers `\n -ContentType: \"application/json; charset=utf-8\" `\n -InFile request.json `\n -Uri \"https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/metadataStores?metadata_store_id=default\" | Select-Object -Expand Content\n ```\n\n You should receive a JSON response similar to the following:\n\n ```\n {\n \"name\": \"projects/PROJECT_ID/locations/LOCATION_ID/operations/OPERATIONS_ID\",\n \"metadata\": {\n \"@type\": \"type.googleapis.com/google.cloud.aiplatform.v1.CreateMetadataStoreOperationMetadata\",\n \"genericMetadata\": {\n \"createTime\": \"2021-05-18T18:47:14.494997Z\",\n \"updateTime\": \"2021-05-18T18:47:14.494997Z\"\n }\n }\n }\n ```\n\n \u003cbr /\u003e"]]