Organízate con las colecciones
Guarda y clasifica el contenido según tus preferencias.
Secret Manager expone una API REST y una API gRPC para usar y gestionar secretos directamente o en tus aplicaciones. En esta página se describe cómo habilitar la API Secret Manager y configurar tu proyecto de Google Cloud para usar Secret Manager por primera vez.
Este paso es un requisito previo para todas las tareas de Secret Manager, incluida la guía de inicio rápido.
Cuando te familiarices con Secret Manager, te recomendamos que utilices un proyecto Google Cloud independiente. Si eliminas el proyecto, también se eliminarán todos los recursos creados durante las pruebas, incluidos los recursos facturables.
Si desarrollas una aplicación en un IDE con Cloud Code instalado, Secret Manager se integra en la extensión. Esto significa que puedes crear, ver, actualizar y usar secretos sin tener que salir de tu IDE. Para obtener más información sobre cómo usar Secret Manager con Cloud Code, consulta la guía de gestión de secretos de tu IDE preferido: VS Code, IntelliJ o Cloud Shell Editor.
Antes de empezar
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.
Para definir tu Google Cloud proyecto en la sesión de gcloud, ejecuta el comando gcloud config set project. Sustituye PROJECT_ID por el ID de tu proyecto. Google Cloud
Para comprobar que la API Secret Manager esté habilitada, ejecuta el comando gcloud services list:
gcloud services list --enabled
Comprueba que la API Secret Manager aparece en la lista de APIs habilitadas.
Configurar roles y permisos
Para obtener los permisos que necesitas para configurar Secret Manager, pide a tu administrador que te conceda el rol de gestión de identidades y accesos Administrador de Secret Manager (roles/secretmanager.admin) en el proyecto.
Para obtener más información sobre cómo conceder roles, consulta el artículo Gestionar el acceso a proyectos, carpetas y organizaciones.
[[["Es fácil de entender","easyToUnderstand","thumb-up"],["Me ofreció una solución al problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Es difícil de entender","hardToUnderstand","thumb-down"],["La información o el código de muestra no son correctos","incorrectInformationOrSampleCode","thumb-down"],["Me faltan las muestras o la información que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-21 (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)."]]