Wenn Sie die automatische Rollenzuweisung deaktivieren, müssen Sie entscheiden, welche Rollen den Standarddienstkonten zugeteilt werden sollen, und diese Rollen dann selbst zuweisen.
Wenn das Standarddienstkonto bereits die Rolle „Bearbeiter“ hat, sollten Sie die Rolle „Bearbeiter“ durch weniger strikte Rollen ersetzen.Verwenden Sie zum sicheren Ändern der Rollen des Dienstkontos den Policy Simulator, um die Auswirkungen der Änderung zu sehen, und weisen Sie die entsprechenden Rollen zu und widerrufen Sie sie.
Hier einige Beispiele für erforderliche Zugriffsbereiche und erforderliche Rollen für verschiedene Szenarien:
Wenn Sie Container-Images aus Artifact Registry-Repositories abrufen möchten, müssen Sie dem Compute Engine-Dienstkonto die Rolle „Artifact Registry-Leser“ (roles/artifactregistry.reader) zuweisen. Außerdem muss der Zugriffsbereichread-only für Cloud Storage-Speicher-Buckets festgelegt sein.
Sie möchten, dass die VM-Instanz in Repositories hochgeladen wird. In diesem Fall müssen Sie einen Zugriffsbereich mit Schreibzugriff auf den Speicher konfigurieren: read-write, cloud-platform oder full-control.
Die VM-Instanz befindet sich in einem anderen Projekt als die Repositories, auf die Sie zugreifen möchten. Weisen Sie in dem Projekt mit den Repositories dem Dienstkonto der Instanz die erforderlichen Berechtigungen zu.
Die Repositories befinden sich im selben Projekt, aber Sie möchten nicht, dass das Standarddienstkonto in allen Repositories dieselbe Zugriffsebene hat. In diesem Fall müssen Sie die entsprechenden Berechtigungen auf Repository-Ebene erteilen und die Artifact Registry-Berechtigungen auf Projektebene widerrufen.
Die VM ist einem benutzerdefinierten Dienstkonto zugeordnet. Prüfen Sie, ob das Dienstkonto über die erforderlichen Berechtigungen und den Zugriffsbereich verfügt.
Sie verwenden benutzerdefinierte Rollen, um Berechtigungen zu gewähren, und die benutzerdefinierte Rolle enthält nicht die erforderlichen Artifact Registry-Berechtigungen. Fügen Sie der Rolle die erforderlichen Berechtigungen hinzu.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-18 (UTC)."],[[["\u003cp\u003eCompute Engine can directly pull containers from Artifact Registry repositories.\u003c/p\u003e\n"],["\u003cp\u003eThe Compute Engine service account requires Artifact Registry access to pull container images.\u003c/p\u003e\n"],["\u003cp\u003eDisabling the automatic Editor role grant for the default service account is recommended and may require you to manually grant specific roles.\u003c/p\u003e\n"],["\u003cp\u003eTo pull images, the service account needs the Artifact Registry Reader role, and \u003ccode\u003eread-only\u003c/code\u003e access scope should be set for Cloud Storage.\u003c/p\u003e\n"],["\u003cp\u003eWhen working with multiple projects, or custom service accounts, ensure the appropriate permissions and access scopes are configured for the specific account.\u003c/p\u003e\n"]]],[],null,["# Deploying to Compute Engine\n\nCompute Engine can pull containers directly from Artifact Registry\nrepositories.\n\nRequired permissions\n--------------------\n\nThe Compute Engine service account needs access to Artifact Registry in\norder to pull container images.\n\n\nDepending on your organization policy configuration, the default service account might\nautomatically be granted the [Editor role](/iam/docs/roles-overview#basic) on your\nproject. We strongly recommend that you disable the automatic role grant by [enforcing the `iam.automaticIamGrantsForDefaultServiceAccounts` organization policy\nconstraint](/resource-manager/docs/organization-policy/restricting-service-accounts#disable_service_account_default_grants). If you created your organization after May 3, 2024, this\nconstraint is enforced by default.\n\n\nIf you disable the automatic role grant, you must decide which roles to grant to the default\nservice accounts, and then [grant these\nroles](/iam/docs/granting-changing-revoking-access) yourself.\n\n\nIf the default service account already has the Editor role, we recommend that you replace the\nEditor role with less permissive roles.To safely modify the service account's roles, use [Policy Simulator](/policy-intelligence/docs/simulate-iam-policies) to see the impact of\nthe change, and then [grant and revoke the\nappropriate roles](/iam/docs/granting-changing-revoking-access).\n\n\u003cbr /\u003e\n\nSome examples of required access scopes and required roles for different\nscenarios are as follows:\n\n- To pull container images from Artifact Registry repositories, you must grant the Compute Engine service account the Artifact Registry Reader role (`roles/artifactregistry.reader`). Additionally, ensure the `read-only` [access scope](/storage/docs/oauth-scopes) is set for Cloud Storage storage buckets.\n- You want the VM instance to upload to repositories. In this case, you must configure an [access scope](/storage/docs/oauth-scopes) with write access to storage: `read-write`, `cloud-platform`, or `full-control`.\n- The VM instance is in a different project than the repositories that you want to access. In the project with the repositories, [grant](/artifact-registry/docs/access-control#grant) the required permissions to the instance's service account.\n- The repositories are in the same project, but you don't want the default service account to have the same level of access across all repositories. In this case, you must grant the appropriate permissions at the repository level and revoke the Artifact Registry permissions at the project level.\n- The VM is associated with a custom service account. Ensure that the service account has the required permissions and access scope.\n- You are using custom roles to grant permissions and the custom role does not include the required Artifact Registry permissions. Add the required [permissions](/artifact-registry/docs/access-control#permissions) to the role."]]