List parameters

This page describes how to retrieve a list of all the parameters within a project.

Listing parameters is useful when you want to get a complete view of all the parameters that you have stored in Parameter Manager, including their names, types, and descriptions. You can also generate reports or gather information about your parameter configurations for auditing purposes.

Required roles

To get the permissions that you need to list parameters, ask your administrator to grant you the Parameter Manager Parameter Viewer (roles/parametermanager.parameterViewer) IAM role on the project, folder, or organization. For more information about granting roles, see Manage access to projects, folders, and organizations.

You might also be able to get the required permissions through custom roles or other predefined roles.

List all parameters

To list all parameters in a project, folder, or organization, use one of the following methods:

Global parameters

Console

  1. In the Google Cloud console, go to the Secret Manager page.

    Go to Secret Manager

  2. Click Parameter Manager to go to the Parameter Manager page. You'll see a list of all the parameters in that project.

gcloud

Before using any of the command data below, make the following replacements:

  • PROJECT_ID: the Google Cloud project ID

Execute the following command:

Linux, macOS, or Cloud Shell

gcloud parametermanager parameters list --location=global --project=PROJECT_ID

Windows (PowerShell)

gcloud parametermanager parameters list --location=global --project=PROJECT_ID

Windows (cmd.exe)

gcloud parametermanager parameters list --location=global --project=PROJECT_ID

You should receive a response similar to the following:

projects/production-1/locations/global/parameters/allowed_ip_ranges                         UNFORMATTED  {'iamPolicyUidPrincipal': 'principal://parametermanager.googleapis.com/projects/567445493557/uid/locations/global/parameters/d81462f3-f333-49d6-8a37-18ba24ad21b3'}  2024-10-23T09:58:00.195567192Z  2024-10-23T09:58:00.521576004Z
projects/production-1/locations/global/parameters/app_config                                FORMATTED  {'iamPolicyUidPrincipal': 'principal://parametermanager.googleapis.com/projects/567445493557/uid/locations/global/parameters/4d3737fa-ab28-47f3-8ca7-4ea4d3de6305'}  2024-10-25T13:54:53.162338414Z  2024-10-25T13:54:53.444576707Z

REST

Before using any of the request data, make the following replacements:

  • PROJECT_ID: the Google Cloud project ID

HTTP method and URL:

GET https://parametermanager.googleapis.com/v1/projects/PROJECT_ID/locations/global/parameters

Request JSON body:

{}

To send your request, choose one of these options:

curl

Save the request body in a file named request.json, and execute the following command:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://parametermanager.googleapis.com/v1/projects/PROJECT_ID/locations/global/parameters"

PowerShell

Save the request body in a file named request.json, and execute the following command:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://parametermanager.googleapis.com/v1/projects/PROJECT_ID/locations/global/parameters" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "parameters": [
    {
      "name": "projects/production-1/locations/global/parameters/app_config",
      "createTime": "2024-10-15T08:39:05.191747694Z",
      "updateTime": "2024-10-15T08:39:05.530311092Z",
      "format": "YAML",
      "policyMember": {
        "iamPolicyUidPrincipal": "principal://parametermanager.googleapis.com/projects/567445493557/uid/locations/global/parameters/c86ca5bc-f4c2-439d-b62c-d578b4b78b12"
      }
    },
    {
      "name": "projects/production-1/locations/global/parameters/allowed_ip_ranges",
      "createTime": "2024-10-15T08:31:53.250487112Z",
      "updateTime": "2024-10-15T08:31:53.576010644Z",
      "format": "UNFORMATTED",
      "policyMember": {
        "iamPolicyUidPrincipal": "principal://parametermanager.googleapis.com/projects/567445493557/uid/locations/global/parameters/c0100d79-7c8d-4da3-8eb6-fe2a35843d9b"
      }
    }
  ]
}

Python

To run this code, first set up a Python development environment and install the Secret Manager Python SDK. On Compute Engine or GKE, you must authenticate with the cloud-platform scope.

def list_params(project_id: str) -> None:
    """
    Lists all parameters in the global location for the specified
    project using the Google Cloud Parameter Manager SDK.

    Args:
        project_id (str): The ID of the project
        where the parameters are located.

    Returns:
        None

    Example:
        list_params(
            "my-project"
        )
    """
    # Import the necessary library for Google Cloud Parameter Manager.
    from google.cloud import parametermanager_v1

    # Create the Parameter Manager client.
    client = parametermanager_v1.ParameterManagerClient()

    # Build the resource name of the parent project in the global location.
    parent = client.common_location_path(project_id, "global")

    # List all parameters in the specified parent project.
    for parameter in client.list_parameters(parent=parent):
        print(f"Found parameter {parameter.name} with format {parameter.format_.name}")

Regional parameters

Console

  1. In the Google Cloud console, go to the Secret Manager page.

    Go to Secret Manager

  2. Click Parameter Manager to go to the Parameter Manager page. You'll see a list of all the parameters in that project.

gcloud

Before using any of the command data below, make the following replacements:

  • LOCATION: the Google Cloud location of the parameter
  • PROJECT_ID: the Google Cloud project ID

Execute the following command:

Linux, macOS, or Cloud Shell

gcloud parametermanager parameters list --location=LOCATION --project=PROJECT_ID

Windows (PowerShell)

gcloud parametermanager parameters list --location=LOCATION --project=PROJECT_ID

Windows (cmd.exe)

gcloud parametermanager parameters list --location=LOCATION --project=PROJECT_ID

You should receive a response similar to the following:

projects/production-1/locations/us-central1/parameters/allowed_ip_ranges                        UNFORMATTED  {'iamPolicyUidPrincipal': 'principal://parametermanager.googleapis.com/projects/567445493557/uid/locations/us-central1/parameters/d81462f3-f333-49d6-8a37-18ba24ad21b3'}  2024-10-23T09:58:00.195567192Z  2024-10-23T09:58:00.521576004Z
projects/production-1/locations/us-central1/parameters/app_config                                FORMATTED  {'iamPolicyUidPrincipal': 'principal://parametermanager.googleapis.com/projects/567445493557/uid/locations/us-central1/parameters/4d3737fa-ab28-47f3-8ca7-4ea4d3de6305'}  2024-10-25T13:54:53.162338414Z  2024-10-25T13:54:53.444576707Z

REST

Before using any of the request data, make the following replacements:

  • LOCATION: the Google Cloud location of the parameters
  • PROJECT_ID: the Google Cloud project ID

HTTP method and URL:

GET https://parametermanager.LOCATION.rep.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/parameters

Request JSON body:

{}

To send your request, choose one of these options:

curl

Save the request body in a file named request.json, and execute the following command:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://parametermanager.LOCATION.rep.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/parameters"

PowerShell

Save the request body in a file named request.json, and execute the following command:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://parametermanager.LOCATION.rep.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/parameters" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "parameters": [
    {
      "name": "projects/production-1/locations/us-central1/parameters/app_config",
      "createTime": "2024-10-30T05:27:28.934719122Z",
      "updateTime": "2024-10-30T05:27:29.010260475Z",
      "format": "YAML",
      "policyMember": {
        "iamPolicyUidPrincipal": "principal://parametermanager.googleapis.com/projects/463050620945/uid/locations/us-central1/parameters/6ffe4045-0778-490a-a786-d77b124e2613"
      }
    },
    {
      "name": "projects/production-1/locations/us-central1/parameters/allowed_ip_ranges",
      "createTime": "2024-10-29T06:18:23.070009070Z",
      "updateTime": "2024-10-29T06:18:23.123580038Z",
      "format": "UNFORMATTED",
      "policyMember": {
        "iamPolicyUidPrincipal": "principal://parametermanager.googleapis.com/projects/463050620945/uid/locations/us-central1/parameters/a7d81e39-3f53-4794-b3c6-484800a18c32"
      }
    }
  ]
}

Python

To run this code, first set up a Python development environment and install the Secret Manager Python SDK. On Compute Engine or GKE, you must authenticate with the cloud-platform scope.

def list_regional_params(project_id: str, location_id: str) -> None:
    """
    Lists all parameters in the specified region for the specified
    project using the Google Cloud Parameter Manager SDK.

    Args:
        project_id (str): The ID of the project where
        the parameters are located.
        location_id (str): The ID of the region where
        the parameters are located.

    Returns:
        None

    Example:
        list_regional_params(
            "my-project",
            "us-central1"
        )
    """
    # Import the necessary library for Google Cloud Parameter Manager.
    from google.cloud import parametermanager_v1

    # Create the Parameter Manager client with the regional endpoint.
    api_endpoint = f"parametermanager.{location_id}.rep.googleapis.com"
    client = parametermanager_v1.ParameterManagerClient(
        client_options={"api_endpoint": api_endpoint}
    )

    # Build the resource name of the parent project in the specified region.
    parent = client.common_location_path(project_id, location_id)

    # List all parameters in the specified parent project and region.
    for parameter in client.list_parameters(parent=parent):
        print(f"Found regional parameter {parameter.name} with format {parameter.format_.name}")

What's next