Cette page explique comment afficher et mettre en œuvre des recommandations sur la suppression de réseaux autorisés pour les instances qui ne respectent pas la règle d'administration constraints/sql.restrictAuthorizedNetworks appliquée par votre administrateur. Ce non-respect des règles se produit lorsque des réseaux autorisés existent déjà pour une instance au moment de l'application de la contrainte. Cet outil de recommandation est appelé Supprimer les réseaux autorisés.
Chaque jour, cet outil de recommandation détecte de manière proactive les instances qui ne respectent pas la règle d'administration constraints/sql.restrictAuthorizedNetworks et fournit des insights et des recommandations pour améliorer la sécurité de vos instances. Vous pouvez afficher les insights et les recommandations détaillées concernant ces instances à l'aide de la console Google Cloud , de gcloud CLI ou de l'API Recommender.
Pour obtenir les autorisations permettant d'afficher et d'utiliser les insights et les recommandations, assurez-vous de disposer des rôles IAM (Identity and Access Management) requis.
GET https://recommender.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/recommenders/google.cloudsql.instance.SecurityRecommender/recommendations?filter=recommenderSubtype=REMOVE_AUTHORIZED_NETWORKS_TO_MEET_ORG_POLICY
Remplacez les éléments suivants :
PROJECT_ID : ID de votre projet
LOCATION : région où se trouvent vos instances, par exemple us-central1.
Afficher les insights et les recommandations détaillées
Pour afficher les insights et les recommandations détaillées, procédez comme suit :
Console
Après avoir listé les recommandations, cliquez sur l'une d'elles.
Le panneau de recommandations s'affiche. Il contient des insights et des recommandations détaillées.
GET https://recommender.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/insightTypes/google.cloudsql.instance.SecurityInsight/insights?filter=insightSubtype=ORG_POLICY_TO_RESTRICT_AUTHORIZED_NETWORKS_VIOLATED
Remplacez les éléments suivants :
PROJECT_ID : ID de votre projet
LOCATION : région où se trouvent vos instances, par exemple us-central1.
Appliquer la recommandation
Console
Pour mettre en œuvre la recommandation, procédez comme suit :
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/08/19 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/08/19 (UTC)."],[],[],null,["# Improve instance security by removing authorized networks\n\n\u003cbr /\u003e\n\n[MySQL](/sql/docs/mysql/recommender-remove-authorized-networks \"View this page for the MySQL database engine\") \\| PostgreSQL \\| [SQL Server](/sql/docs/sqlserver/recommender-remove-authorized-networks \"View this page for the SQL Server database engine\")\n\n\u003cbr /\u003e\n\nThis page describes how to view and implement recommendations about\nremoving authorized networks for instances that violate the\n[`constraints/sql.restrictAuthorizedNetworks` organization policy](/sql/docs/mysql/org-policy/org-policy#connection-constraints) enforced by your\nadministrator. This policy violation occurs when authorized networks already exist for an instance at the time of enforcement of the constraint. This [recommender](/recommender/docs/overview) is called **Remove authorized networks**.\n\nEvery day, this recommender\nproactively detects instances that violate the\n`constraints/sql.restrictAuthorizedNetworks` organization policy and provides insights and recommendations to improve\nyour instance security. You can view insights and detailed recommendations about these instances by using the Google Cloud console,\n[gcloud CLI](/sdk/gcloud), or the [Recommender API](/recommender/docs/using-api).\n\nFor more information about organization policies, see [Cloud SQL organization policies](/sql/docs/postgres/org-policy/org-policy).\n\nBefore you begin\n----------------\n\nEnsure that you [enable the Recommender API](/recommender/docs/enabling).\n\n### Required roles and permissions\n\nTo get the permissions to view and work with insights and recommendations,\nensure that you have the required [Identity and Access Management (IAM) roles](/sql/docs/postgres/project-access-control#roles).\n\nFor more information about IAM roles, see [IAM basic and predefined roles reference](/iam/docs/understanding-roles) and [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\u003cbr /\u003e\n\nList the recommendations\n------------------------\n\nTo list the recommendations, follow these steps: \n\n### Console\n\nTo list recommendations about instance security, follow these steps:\n\n1. Go to the **Cloud SQL Instances** page.\n\n [Go to Cloud SQL Instances](https://console.cloud.google.com/sql/instances)\n2. View the **Issues** column in the instance table.\n\nAlternatively, follow these steps:\n\n1. Go to the **Recommendation Hub**.\n\n [Go to the Recommendation Hub](https://console.cloud.google.com/home/recommendations/)\n\n For more information, see [Exploring recommendations](/recommender/docs/recommendation-hub/identify-configuration-problems).\n2. In the **All recommendations** card, click **Security**.\n\n### gcloud\n\nRun the [`gcloud recommender recommendations list`](/sdk/gcloud/reference/recommender/recommendations/list) command as follows: \n\n```\ngcloud recommender recommendations list \\\n--project=PROJECT_ID \\\n--location=LOCATION \\\n--recommender=google.cloudsql.instance.SecurityRecommender \\\n--filter=recommenderSubtype=REMOVE_AUTHORIZED_NETWORKS_TO_MEET_ORG_POLICY\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region where your instances are located, such as us-central1.\n\n### API\n\nCall the [`recommendations.list`](/recommender/docs/reference/rest/v1beta1/projects.locations.recommenders.recommendations/list) method as follows: \n\n```\nGET https://recommender.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/recommenders/google.cloudsql.instance.SecurityRecommender/recommendations?filter=recommenderSubtype=REMOVE_AUTHORIZED_NETWORKS_TO_MEET_ORG_POLICY\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region where your instances are located, such as `us-central1`.\n\nView insights and detailed recommendations\n------------------------------------------\n\nTo view insights and detailed recommendations, follow these steps: \n\n### Console\n\nAfter listing the recommendations, click a recommendation.\nThe recommendation panel appears, which contains insights and detailed recommendations.\n\n### gcloud\n\nRun the [`gcloud recommender insights list`](/sdk/gcloud/reference/recommender/insights/list) command as follows: \n\n```\n\ngcloud recommender insights list \\\n--project=PROJECT_ID \\\n--location=LOCATION \\\n--insight-type=google.cloudsql.instance.SecurityInsight \\\n--filter=insightSubtype=ORG_POLICY_TO_RESTRICT_AUTHORIZED_NETWORKS_VIOLATED\n\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e : A region where your instances are located, such as `us-central1`.\n\n### API\n\nCall the [`insights.list`](/recommender/docs/reference/rest/v1beta1/projects.locations.insightTypes.insights/list) method as follows: \n\n```\n\nGET https://recommender.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/insightTypes/google.cloudsql.instance.SecurityInsight/insights?filter=insightSubtype=ORG_POLICY_TO_RESTRICT_AUTHORIZED_NETWORKS_VIOLATED\n\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region where your instances are located, such as `us-central1`.\n\nApply the recommendation\n------------------------\n\n### Console\n\nTo implement the recommendation, do the following:\n\n1. Click **Manage authorized networks**.\n\n2. Configure your clients to use [Cloud SQL Auth Proxy](/sql/docs/postgres/sql-proxy) and [Cloud SQL Language Connectors](/sql/docs/postgres/language-connectors).\n\n3. Remove the\n [authorized networks](/sql/docs/postgres/authorize-networks#authorized-networks)\n on your instance.\n\n### gcloud\n\nTo implement the recommendation, do the following:\n\n1. Configure your clients to use [Cloud SQL Auth Proxy](/sql/docs/postgres/sql-proxy) and [Cloud SQL Language Connectors](/sql/docs/postgres/language-connectors).\n\n2. Remove the\n [authorized networks](/sql/docs/postgres/authorize-networks#authorized-networks)\n on your instance.\n\n### API\n\nTo implement the recommendation, do the following:\n\n1. Configure your clients to use [Cloud SQL Auth Proxy](/sql/docs/postgres/sql-proxy) and [Cloud SQL Language Connectors](/sql/docs/postgres/language-connectors).\n\n2. Remove the\n [authorized networks](/sql/docs/postgres/authorize-networks#authorized-networks)\n on your instance.\n\nWhat's next\n-----------\n\n- [Authorized networks](/sql/docs/postgres/authorize-networks#authorized-networks)\n- [Cloud SQL Auth Proxy](/sql/docs/postgres/sql-proxy)\n- [Cloud SQL Language Connectors](/sql/docs/postgres/language-connectors)\n- [Google Cloud recommenders](/recommender/docs/recommenders)\n- [Blog: Maximize your Cloud ROI](https://cloud.google.com/blog/products/management-tools/active-assist-comes-to-google-cloud)"]]