Add predefined organization policies Stay organized with collections Save and categorize content based on your preferences.
This page describes how to add organization policies on Cloud SQLinstances, to put restrictions on Cloud SQL at the project, folder, ororganization level. For an overview, seeCloud SQL organization policies.
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
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.Make sure that billing is enabled for your Google Cloud project.
Install thegcloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Toinitialize the gcloud CLI, run the following command:
gcloudinit
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
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.Make sure that billing is enabled for your Google Cloud project.
Install thegcloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Toinitialize the gcloud CLI, run the following command:
gcloudinit
- Add theOrganization Policy Administrator role (
roles/orgpolicy.policyAdmin
) to your user or service account from theIAM & Admin page. - SeeRestrictions before performing this procedure.
Add the connection organization policy
For an overview seeConnection organization policies.
To add a connection organization policy:
Go to theOrganization policies page.
Click projects dropdown menu in the top tab, and then select the project, folder,or organization that requires the organization policy. TheOrganization policies page displays a list of organization policyconstraints that are available.
Filter for the constraint
name
ordisplay_name
.To disable access to or from the Internet:
name:"constraints/sql.restrictPublicIp"display_name:"Restrict Public IP access on Cloud SQL instances"
To disable access from the internet when IAM authentication is missing(this does not affect access using Private IP):
name:"constraints/sql.restrictAuthorizedNetworks"display_name:"Restrict Authorized Networks on Cloud SQL instances"
Select the policyName from the list.
ClickEdit.
ClickCustomize.
ClickAdd rule.
UnderEnforcement, clickOn.
ClickSave.
Add the CMEK organization policy
For an overview, seeCustomer-managed encryption keys organization policies.
To add a CMEK organization policy:
Go to theOrganization policies page.
Click projects dropdown menu in the top tab, and then select the project, folder,or organization that requires the organization policy. TheOrganization policies page displays a list of organization policyconstraints that are available.
Filter for the constraint
name
ordisplay_name
.To put service names in a DENY list to ensure that CMEK is used in theresources for that service:
name:"constraints/gcp.restrictNonCmekServices"display_name:"Restrict which services may create resources without CMEK"
You must add
sqladmin.googleapis.com
to the list of restricted serviceswith Deny.To put project IDs in an ALLOW list to ensure that only keys from aninstance of Cloud KMS within that project are used for CMEK.
name:"constraints/gcp.restrictCmekCryptoKeyProjects"display_name:"Restrict which projects may supply KMS CryptoKeys for CMEK"
Select the policyName from the list.
ClickEdit.
ClickCustomize.
ClickAdd rule.
UnderPolicy values, clickCustom.
For
constraints/gcp.restrictNonCmekServices
:a. UnderPolicy types, selectDeny.b. UnderCustom values, entersqladmin.googleapis.com
.For
constraints/gcp.restrictCmekCryptoKeyProjects
:a. UnderPolicy types, selectAllow.b. UnderCustom values, enter the resource using the following format:under:organizations/ORGANIZATION_ID
,under:folders/FOLDER_ID
, orprojects/PROJECT_ID
.ClickDone.
ClickSave.
What's next
- Learn aboutOrganization policies.
- Learn about howprivate IP works with Cloud SQL.
- Learn how toconfigure private IP for Cloud SQL.
- Learn about theorganization policy service.
- Learn aboutorganization policy constraints.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-14 UTC.