Run an Azure Script

Octopus.AzurePowerShell exported 2026-07-22 by Octopus Deploy belongs to ‘Azure’ category.

Run a script using an Azure subscription, with Azure modules loaded by default.

Parameters

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

Account

Octopus.Action.Azure.AccountId (required)

Select the Azure account to use to run the script.

Example: azure-account-1

Azure Tools

OctopusUseBundledTooling

Select whether to use the bundled Azure tools or tooling pre-installed on the worker.

Allowed values: True, False

Default: False

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.

Allowed values: PowerShell, Bash

Script Body

Octopus.Action.Script.ScriptBody

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

Script File Name

Octopus.Action.Script.ScriptFileName

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

Example: Deploy.ps1

Script Parameters

Octopus.Action.Script.ScriptParameters

Parameters to pass to the script.

Example: -Environment #{Octopus.Environment.Name}

Optional features

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

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.

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.

.NET Configuration Transforms Octopus.Features.ConfigurationTransforms

Runs configuration file transforms. Enabled by default for package deployments.

Octopus.Action.Package.AutomaticallyRunConfigurationTransformationFiles

Octopus.Action.Package.AutomaticallyRunConfigurationTransformationFiles

Run default XML transforms (True/False).

Octopus.Action.Package.AdditionalXmlConfigurationTransforms

Octopus.Action.Package.AdditionalXmlConfigurationTransforms

Comma- or newline-separated list of additional transform rules (e.g. Web.Release.config => Web.config).

.NET Configuration Variables Octopus.Features.ConfigurationVariables

Replace appSettings and connectionStrings in .config files. Enabled by default for package deployments.

Octopus.Action.Package.AutomaticallyUpdateAppSettingsAndConnectionStrings

Octopus.Action.Package.AutomaticallyUpdateAppSettingsAndConnectionStrings

Replace appSettings and connectionStrings in .config files (True/False).

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-an-azure-script" {
    name = "Run an Azure Script"

    action {
        action_type = "Octopus.AzurePowerShell"
        properties = {
            Octopus.Action.Azure.AccountId = "azure-account"
            Octopus.Action.RunOnServer = "false"
            Octopus.Action.Script.ScriptBody = "Write-Host 'Hello from Azure'; Get-AzContext"
            Octopus.Action.Script.ScriptSource = "Inline"
            Octopus.Action.Script.Syntax = "PowerShell"
            OctopusUseBundledTooling = "False"
        }
    }
}

Page updated on Wednesday, July 22, 2026