Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Secret Manager mengekspos REST API dan gRPC API untuk menggunakan dan mengelola secret secara langsung atau di aplikasi Anda. Halaman ini menjelaskan cara mengaktifkan
Secret Manager API dan mengonfigurasi project Google Cloud untuk menggunakan
Secret Manager untuk pertama kalinya.
Langkah ini adalah prasyarat untuk semua tugas di Secret Manager, termasuk
panduan memulai.
Saat Anda mulai memahami Secret Manager, sebaiknya gunakan
project Google Cloud terpisah. Menghapus project juga akan menghapus semua resource yang dibuat selama pengujian, termasuk resource yang dapat ditagih.
Jika Anda mengembangkan aplikasi di IDE dengan Cloud Code terinstal, Secret Manager terintegrasi ke dalam ekstensi. Artinya, Anda
dapat membuat, melihat, memperbarui, dan menggunakan secret tanpa harus keluar dari IDE. Untuk mengetahui informasi selengkapnya tentang penggunaan Secret Manager dengan Cloud Code, lihat panduan pengelolaan secret untuk IDE pilihan Anda, VS Code, IntelliJ, atau Cloud Shell Editor.
Sebelum memulai
In the Google Cloud console, go to the project selector page.
At the bottom of the Google Cloud console, a
Cloud Shell
session starts and displays a command-line prompt. Cloud Shell is a shell environment
with the Google Cloud CLI
already installed and with values already set for
your current project. It can take a few seconds for the session to initialize.
Untuk menetapkan project Google Cloud di sesi gcloud, jalankan perintah gcloud config set project. Ganti PROJECT_ID dengan Google Cloud project ID Anda.
Untuk memverifikasi bahwa Secret Manager API sudah diaktifkan, jalankan perintah gcloud services list:
gcloud services list --enabled
Pastikan Secret Manager API tercantum dalam daftar API yang diaktifkan.
Mengonfigurasi peran dan izin
Untuk mendapatkan izin yang diperlukan guna menyiapkan Secret Manager, minta administrator Anda untuk memberi Anda peran IAM Secret Manager Admin (roles/secretmanager.admin) di project.
Untuk mengetahui informasi selengkapnya tentang cara memberikan peran, lihat Mengelola akses ke project, folder, dan organisasi.
Anda mungkin juga bisa mendapatkan
izin yang diperlukan melalui peran
khusus atau peran
bawaan lainnya.
Untuk mengetahui informasi selengkapnya tentang kontrol akses untuk Secret Manager, lihat
Kontrol akses dengan IAM.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-18 UTC."],[],[],null,["# Enable the Secret Manager API\n\nSecret Manager exposes a REST API and a gRPC API for using and managing secrets\ndirectly or in your applications. This page describes how to enable the\nSecret Manager API and configure your Google Cloud project to use\nSecret Manager for the first time.\n\nThis step is a prerequisite for all tasks in Secret Manager, including the\n[quickstart](/secret-manager/docs/quickstart).\n\nWhen you are becoming familiar with Secret Manager, we recommend using a\nseparate Google Cloud project. Deleting the project also deletes all\nresources created during testing, including billable resources.\n\nIf you are developing an application in an IDE with [Cloud Code](https://cloud.google.com/code) installed,\nSecret Manager comes integrated into the extension. This means that you\ncan create, view, update, and use secrets without having to leave your IDE. For\nmore on using Secret Manager with Cloud Code, refer to the secret\nmanaging guide for your preferred IDE,\n[VS Code](/code/docs/vscode/secret-manager),\n[IntelliJ](/code/docs/intellij/secret-manager),\nor [Cloud Shell Editor](/code/docs/shell/secret-manager).\n\nBefore you begin\n----------------\n\n1. In the Google Cloud console, go to the project selector page.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n2. Select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\nEnable the Secret Manager API\n-----------------------------\n\n### Console\n\n1. In the Google Cloud console, go to the **Secret Manager API** page.\n\n [Go to Secret Manager API](https://console.cloud.google.com/apis/library/secretmanager.googleapis.com)\n2. Verify that the name of your project appears in the project selector at the top of the page.\n\n If you don't see the name of your project, click the project selector, and then select your project.\n3. Click **Enable**.\n\n### gcloud\n\n1. In the Google Cloud console, activate Cloud Shell.\n\n [Activate Cloud Shell](https://console.cloud.google.com/?cloudshell=true)\n\n\n At the bottom of the Google Cloud console, a\n [Cloud Shell](/shell/docs/how-cloud-shell-works)\n session starts and displays a command-line prompt. Cloud Shell is a shell environment\n with the Google Cloud CLI\n already installed and with values already set for\n your current project. It can take a few seconds for the session to initialize.\n2. To set your Google Cloud project in the gcloud session, run the [`gcloud config set project`](/sdk/gcloud/reference/config/set) command. Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with your Google Cloud project ID. \n\n ```scdoc\n gcloud config set project PROJECT_ID\n ```\n3. To enable the Secret Manager API, run the [`gcloud services enable`](/sdk/gcloud/reference/services/enable) command: \n\n ```text\n gcloud services enable secretmanager.googleapis.com\n ```\n4. To verify that the Secret Manager API is enabled, run the [`gcloud services list`](/sdk/gcloud/reference/services/list) command: \n\n ```text\n gcloud services list --enabled\n ```\n\n Verify that the Secret Manager API is listed in the list of enabled APIs.\n\nConfigure roles and permissions\n-------------------------------\n\n\nTo get the permissions that\nyou need to set up Secret Manager,\n\nask your administrator to grant you the\n\n\n[Secret Manager Admin](/iam/docs/roles-permissions/secretmanager#secretmanager.admin) (`roles/secretmanager.admin`)\nIAM role on the project.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nYou might also be able to get\nthe required permissions through [custom\nroles](/iam/docs/creating-custom-roles) or other [predefined\nroles](/iam/docs/roles-overview#predefined).\n\nFor more information about the access control for Secret Manager, see\n[Access control with IAM](/secret-manager/docs/access-control).\n\nWhat's next\n-----------\n\n- Learn more about [authentication and access](/secret-manager/docs/authentication) to the Secret Manager API.\n- Learn more about [creating secrets](/secret-manager/docs/creating-and-accessing-secrets).\n- Learn more about [adding a secret version](/secret-manager/docs/add-secret-version)."]]