List service dependencies
Hierarchical service activation lets you manage service enablement that is inherited through the Google Cloud resource hierarchy. For more information, see the overview.
Many Google Cloud services need other services to function. When
you enable a service using hierarchical service activation, its required dependencies are
automatically added to the ConsumerPolicy. A service dependency group
contains these relied-on services, which you can list to better understand and
manage them.
This document shows you how to use the Google Cloud CLI to list service dependencies for projects, folders, and organizations.
Before you begin
Complete the "Before you begin" steps detailed in the Manage service enablement guide.
If you don't indicate the Google Cloud resource that you want to manage, the commands in this document default to the current project. For example,
gcloud beta services groups list-members bigquery.googleapis.com dependencieslists the members for the current project.You can retrieve the current project ID:
gcloud config list --format='text(core.project)'
List dependency group members
You can list the direct members of a service dependency group for a project,
folder, or organization by using the
gcloud beta services groups list-members
command.
Project
gcloud beta services groups list-members SERVICE GROUP \
--project=PROJECT_ID
Replace the following:
SERVICE: the name of the service you want to list members for.GROUP: the name of the service dependency group you want to list members for. The primary supported group isdependencies.PROJECT_ID: your Google Cloud project ID. Or, omit the flag to default to the current project.
Folder
gcloud beta services groups list-members SERVICE GROUP \
--folder=FOLDER_ID
Replace the following:
SERVICE: the name of the service you want to list members for.GROUP: the name of the service dependency group you want to list members for. The primary supported group isdependencies.FOLDER_ID: your Google Cloud folder ID.
Organization
gcloud beta services groups list-members SERVICE GROUP \
--organization=ORGANIZATION_ID
Replace the following:
SERVICE: the name of the service you want to list members for.GROUP: the name of the service dependency group you want to list members for. The primary supported group isdependencies.ORGANIZATION_ID: your Google Cloud organization resource ID.
You can use other flags to filter and limit the members listed.
List expanded dependency group members
You can list the expanded members of a service dependency group for a project,
folder, or organization by using the
gcloud beta services groups list-expanded-members
command.
This command returns a flattened list of all dependencies, including those in nested groups, to provide a complete, combined list of all service dependencies.
Project
gcloud beta services groups list-expanded-members SERVICE GROUP \
--project=PROJECT_ID
Replace the following:
SERVICE: the name of the service you want to list members for.GROUP: the name of the service dependency group you want to list members for. The primary supported group isdependencies.PROJECT_ID: your Google Cloud project ID. Or, omit the flag to default to the current project.
Folder
gcloud beta services groups list-expanded-members SERVICE GROUP \
--folder=FOLDER_ID
Replace the following:
SERVICE: the name of the service you want to list members for.GROUP: the name of the service dependency group you want to list members for. The primary supported group isdependencies.FOLDER_ID: your Google Cloud folder ID.
Organization
gcloud beta services groups list-expanded-members SERVICE GROUP \
--organization=ORGANIZATION_ID
Replace the following:
SERVICE: the name of the service you want to list members for.GROUP: the name of the service dependency group you want to list members for. The primary supported group isdependencies.ORGANIZATION_ID: your Google Cloud organization resource ID.
You can use other flags to filter and limit the members listed.
Examples
Listing direct dependency group members
- Listing direct dependencies of BigQuery service for the current project:
gcloud beta services groups list-members bigquery.googleapis.com dependencies
Output:
NAME: services/analyticshub.googleapis.com REASON: BigQuery depends on this group to allow users to exchange data and analytics assets. NAME: services/bigquery.googleapis.com REASON: The service representing BigQuery which owns this dependency group and depends on the other members of this group. NAME: services/bigqueryconnection.googleapis.com REASON: BigQuery depends on this group to allow users to manage connections to external data sources. NAME: services/bigquerydatapolicy.googleapis.com REASON: BigQuery depends on this group to allow users to manage their data policies. ...
- Attempting to list dependencies of API keys service without a corresponding service dependency group:
gcloud beta services groups list-members apikeys.googleapis.com dependencies --project=test-project
Output:
Listed 0 items.
Listing expanded dependency group members
- Listing expanded dependencies of BigQuery service for the current project:
gcloud beta services groups list-expanded-members bigquery.googleapis.com dependencies
Output:
services/analyticshub.googleapis.com services/bigquery.googleapis.com services/bigqueryconnection.googleapis.com services/bigquerydatapolicy.googleapis.com services/bigquerydatatransfer.googleapis.com services/bigquerymigration.googleapis.com services/bigqueryreservation.googleapis.com services/bigquerystorage.googleapis.com services/cloudresourcemanager.googleapis.com services/dataform.googleapis.com services/dataplex.googleapis.com
What's next
- To enable and disable services, see Manage service enablement.
- To manage policies, see Manage consumer policies.