Create a key
You can create API keys in MeshAgent Studio or with the CLI. The secret value is only shown once.MeshAgent Studio
- Open your project in MeshAgent Studio.
- Go to Access Management.
- Open a service account’s API Keys menu.
- Create a new key and save the secret value.
MeshAgent CLI
If you want to create a key from the terminal and activate it for local CLI use at the same time:--activate saves the new key in your local CLI project settings so commands that use an API key can pick it up automatically.
To activate an existing key later, use:
Permissions to create keys
The caller must have bothapi_key_creator and api_key_manager on the project. Service accounts do not have these roles by default, so a default service account cannot create API keys, including keys for itself. OAuth credentials must also include the developer scope.
A project administrator can assign the roles with the CLI. For example, to give a service account member, developer, and both API-key roles:
iam grant replaces the subject’s direct roles on that resource. Include any other existing direct roles you want to retain in the same command.
These permissions apply to the whole project. A service account with both roles can create an API key for any other service account in that project and use that key to act as the target account. Grant these roles only to callers trusted with that authority.
Rotate or remove keys
List the keys for a service account in the active project:Best practices
- Rotate regularly and delete unused keys.
- Store keys securely in a secret manager or CI vault.
- Avoid sharing keys across multiple services.