Run gcloud in a Script

Octopus.GoogleCloudScripting exported 2026-07-22 by Octopus Deploy belongs to ‘Google’ category.

Run a script with the gcloud CLI, authenticated against a Google Cloud account.

Parameters

When this step is included in a project’s deployment process, the parameters below can be set.

Use VM Service Account

Octopus.Action.GoogleCloud.UseVMServiceAccount (required)

When running in a Compute Engine virtual machine, use the associated VM service account for authentication.

Allowed values: True, False

Default: True

Google Cloud Account

Octopus.Action.GoogleCloudAccount.Variable

The variable that references the Google Cloud account to use for authentication. Required when not using a VM service account.

Example: GoogleCloudAccount

Impersonate Service Account

Octopus.Action.GoogleCloud.ImpersonateServiceAccount (required)

Whether to impersonate a service account when executing the script.

Allowed values: True, False

Default: False

Service Account Emails

Octopus.Action.GoogleCloud.ServiceAccountEmails

A comma-separated list of service account emails to impersonate, forming a delegation chain. Required when impersonating service accounts.

Example: my-service-account@my-project.iam.gserviceaccount.com

Project

Octopus.Action.GoogleCloud.Project

The default Google Cloud project. Sets the CLOUDSDK_CORE_PROJECT environment variable.

Example: my-gcp-project

Region

Octopus.Action.GoogleCloud.Region

The default Google Cloud region. Sets the CLOUDSDK_COMPUTE_REGION environment variable.

Example: us-central1

Zone

Octopus.Action.GoogleCloud.Zone

The default Google Cloud zone. Sets the CLOUDSDK_COMPUTE_ZONE environment variable.

Example: us-central1-a

Script Source

Octopus.Action.Script.ScriptSource (required)

The source of the script to run.

Allowed values: Inline, Package, GitRepository

Default: Inline

Script Syntax

Octopus.Action.Script.Syntax

The scripting language to use. Required when the script source is Inline.

Allowed values: PowerShell, Bash

Script Body

Octopus.Action.Script.ScriptBody

The inline script body to execute when the script source is set to Inline.

Script File Name

Octopus.Action.Script.ScriptFileName

The path to the script file inside the package or Git repository.

Example: Deploy.sh

Script Parameters

Octopus.Action.Script.ScriptParameters

Parameters to pass to the script.

Optional features

Enable features by adding their IDs to Octopus.Action.EnabledFeatures (a comma-separated list).

Structured Configuration Variables Octopus.Features.JsonConfigurationVariables

Replace settings in JSON, YAML, XML, and Java Properties files with Octopus variables. Enabled by default for package deployments.

Octopus.Action.Package.JsonConfigurationVariablesTargets

Octopus.Action.Package.JsonConfigurationVariablesTargets

Newline-separated list of target files (e.g. appsettings.json). Wildcards supported.

Substitute Variables in Templates Octopus.Features.SubstituteInFiles

Transforms files using the Octopus #{Variable} substitution syntax. Enabled by default for package deployments.

Octopus.Action.SubstituteInFiles.TargetFiles

Octopus.Action.SubstituteInFiles.TargetFiles

Newline-separated list of file names to transform (relative to package). Wildcards supported.

Octopus.Action.SubstituteInFiles.OutputEncoding

Octopus.Action.SubstituteInFiles.OutputEncoding

Encoding name for the output file (e.g. utf-8). Optional.

PowerShell Edition Octopus.Features.SelectPowerShellEditionForWindows

Specify the edition of PowerShell used during deployments on Windows.

Octopus.Action.PowerShell.Edition

Octopus.Action.PowerShell.Edition

PowerShell edition on Windows (Desktop or Core).

Allowed values: Desktop, Core

Step configuration using OCL

Example in Octopus Configuration Language (OCL):

step "run-google-cloud-script" {
    name = "Run Google Cloud Script"

    action {
        action_type = "Octopus.GoogleCloudScripting"
        properties = {
            Octopus.Action.GoogleCloud.ImpersonateServiceAccount = "False"
            Octopus.Action.GoogleCloud.Project = "my-gcp-project"
            Octopus.Action.GoogleCloud.Region = "us-central1"
            Octopus.Action.GoogleCloud.UseVMServiceAccount = "False"
            Octopus.Action.GoogleCloud.Zone = "us-central1-a"
            Octopus.Action.GoogleCloudAccount.Variable = "google-account"
            Octopus.Action.RunOnServer = "false"
            Octopus.Action.Script.ScriptBody = "gcloud config list"
            Octopus.Action.Script.ScriptSource = "Inline"
            Octopus.Action.Script.Syntax = "PowerShell"
        }
    }
}

Page updated on Wednesday, July 22, 2026