Java 8 ha raggiunto la fine del supporto
e verrà ritirato
il 31 gennaio 2026. Dopo il ritiro, non potrai eseguire il deployment di applicazioni Java 8, anche se la tua organizzazione ha utilizzato in precedenza un criterio dell'organizzazione per riattivare i deployment di runtime legacy. Le tue applicazioni Java 8 esistenti continueranno a essere eseguite e a ricevere traffico dopo la
data di ritiro. Ti consigliamo di eseguire la migrazione all'ultima versione supportata di Java.
Utilizzo di account di servizio gestiti dall'utente
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Le app App Engine richiedono un account di servizio per accedere ad altri servizi Google Cloud
ed eseguire attività. Per impostazione predefinita, l'account di servizio predefinito di App Engine viene utilizzato come identità della tua app App Engine. Puoi anche specificare un service account gestito dall'utente diverso da utilizzare come identità per una versione specifica della tua app App Engine. Ciò ti consente di concedere privilegi diversi a ogni versione, in base alle attività specifiche che svolge, ed evitare di concedere più privilegi del necessario.
Questa guida spiega come specificare un account di servizio gestito dall'utente diverso durante
il deployment di una nuova versione. Se non devi creare un account di servizio distinto
quando esegui il deployment di una versione specifica della tua app, puoi continuare a utilizzare il
account di servizio predefinito non specificandone uno.
Creazione di un account di servizio gestito dall'utente
Per creare un account di servizio gestito dall'utente, consulta
queste istruzioni.
Quando definisci i ruoli Identity and Access Management (IAM) da concedere al service account, puoi fare riferimento a
Ruoli che concedono l'accesso ad App Engine.
Dopo aver creato il account di servizio gestito dall'utente, puoi aggiornare il account di servizio predefinito a livello di app per la tua applicazione utilizzando uno dei seguenti metodi:
SERVICE_ACCOUNT_NAME con il nome del account di servizio che hai creato.
PROJECT_ID con l'ID del progetto Google Cloud in cui vuoi assegnare il account di servizio.
Ogni nuova versione che implementi dopo questo aggiornamento utilizza il nuovo service account predefinito a livello di app, a meno che tu non assegni esplicitamente un account di servizio specifico per la versione.
Console
Vai alla scheda Impostazioni applicazione di App Engine nella console e fai clic su
Modifica impostazioni applicazione.
Scegli un account di servizio predefinito a livello di app da Seleziona un service account
e fai clic su Salva.
Verrà visualizzata la scheda Impostazioni applicazione, dove potrai vedere l'indirizzo email
del tuoaccount di serviziot predefinito a livello di app aggiornato. Esempio:
SERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com.
Ogni nuova versione che implementi dopo questo aggiornamento utilizza il nuovo service account predefinito a livello di app, a meno che tu non assegni esplicitamente un account di servizio specifico per la versione.
Specificare un account di servizio durante il deployment dell'app
gcloud
Esegui il comando gcloud app deploy e specifica il tuo account di servizio:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eApp Engine apps use a service account to access other Google Cloud services, with the App Engine default service account being the default identity.\u003c/p\u003e\n"],["\u003cp\u003eYou can use a user-managed service account instead of the default for a specific version of your App Engine app, allowing for tailored privileges.\u003c/p\u003e\n"],["\u003cp\u003eUser-managed service accounts can be specified when deploying a new version of your app via the \u003ccode\u003egcloud app deploy\u003c/code\u003e command or within the \u003ccode\u003eappengine-web.xml\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eIt is important not to remove the App Engine standard environment service agent in your project, as it delegates the user-managed service account as the identity for your app.\u003c/p\u003e\n"],["\u003cp\u003eWhen specifying a user-managed service account, if it's set in both the \u003ccode\u003eapp.yaml\u003c/code\u003e file and through the \u003ccode\u003egcloud\u003c/code\u003e CLI, the \u003ccode\u003egcloud\u003c/code\u003e setting will be prioritized.\u003c/p\u003e\n"]]],[],null,["# Using user-managed service accounts\n\nApp Engine apps require a service account in order to access other Google Cloud\nservices and execute tasks. By default, the\n\n[App Engine default service account](/appengine/docs/legacy/standard/java/service-account)\n\nis used as the identity of your App Engine app. You may also specify a\ndifferent [user-managed service\naccount](/iam/docs/service-account-types#user-created) to be used as the\nidentity for a specific version of your App Engine app. This allows you\nto grant different privileges to each version, based on the specific tasks it\nperforms, and avoid granting more privileges than necessary.\n\nThis guide covers how to specify a different user-managed service account when\ndeploying a new version. If you don't need to create a distinct service account\nwhen deploying a specific version of your app, you can continue to use the\ndefault service account by not specifying a service account.\n\nCreating a user-managed service account\n---------------------------------------\n\nTo create a user-managed service account, see\n[these instructions](/appengine/docs/legacy/standard/java/access-control#service_account).\nWhen defining the Identity and Access Management (IAM) roles to grant your service\naccount, you can refer to\n[Roles that Grant Access to App Engine](/appengine/docs/legacy/standard/java/roles).\n\nIf you need to review IAM concepts before creating your service account, see\n[IAM concepts overview](/iam/docs/overview) and\n[service accounts](/iam/docs/service-accounts) guides.\n| **Warning:** Do not remove the existing App Engine standard environment service agent in your project. The [service agent](/iam/docs/service-agents) delegates the user-managed service account as the identity for your app. If you remove the service agent, you will see IAM permission errors.\n\nAfter you create your user-managed service account, you can update the\napp-level default service account for your application by using one of the\nfollowing methods:\n**Important:** Only versions deployed after the update will use the new app-level default service account. All previously deployed versions will not use the new app-level default service account until you re-deploy that version. \n\n### gcloud\n\nRun the `gcloud app update` command. \n\n gcloud app update --service-account=\u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_NAME\u003c/var\u003e@\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e.iam.gserviceaccount.com\n\nReplace:\n\n- `SERVICE_ACCOUNT_NAME` with the name of the service account that you created.\n- `PROJECT_ID` with ID of the Google Cloud project in which you want to assign the service account.\n\nEach new version that you deploy after this update uses the new app-level default service\naccount unless you explicitly assign a version-specific service account.\n\n### Console\n\n1. Go to the App Engine **Application Settings** tab in the console and click\n **Edit Application Settings**.\n\n [Go to Application Settings](https://console.cloud.google.com/appengine/settings)\n2. Choose an app-level default service account from **Select a Service account**\n and click **Save**.\n\n You will be redirected to the **Application Settings** tab where you can view the email\n address of your updated app-level default service account. Example:\n \u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_NAME\u003c/var\u003e`@`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.iam.gserviceaccount.com`.\n\n Each new version that you deploy after this update uses the new app-level default service\n account unless you explicitly assign a version-specific service account.\n\nSpecifying a service account when deploying your app\n----------------------------------------------------\n\n**Note:** If a user-managed service account is specified in both the `app.yaml` file and in the gcloud CLI, the `gcloud` setting is used. \n\n### gcloud\n\nRun the `gcloud app deploy` command and specify your service account: \n\n gcloud app deploy --service-account=\u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_NAME\u003c/var\u003e@\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e.iam.gserviceaccount.com\n\n### appengine-web.xml\n\nIn your [`appengine-web.xml`](/appengine/docs/legacy/standard/java/config/appref) file, specify your service account by adding the\n[`\u003cservice-account\u003e`](/appengine/docs/legacy/standard/java/config/appref#service-account) element: \n\n \u003cservice-account\u003e\u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_NAME\u003c/var\u003e@\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e.iam.gserviceaccount.com\u003c/service-account\u003e\n\nNext steps\n----------\n\nFollow [best practices for working with service accounts](/iam/docs/best-practices-service-accounts)."]]