AzurePowerShell@1 - Azure PowerShell v1 task

Use this task to run a PowerShell script within an Azure environment. The Azure context is authenticated with the provided Azure Resource Manager service connection.

Syntax

# Azure PowerShell v1
# Run a PowerShell script within an Azure environment.
- task: AzurePowerShell@1
  inputs:
    #ConnectedServiceNameSelector: 'ConnectedServiceName' # 'ConnectedServiceName' | 'ConnectedServiceNameARM'. Azure Connection Type. Default: ConnectedServiceName.
    ConnectedServiceName: # string. Required when ConnectedServiceNameSelector = ConnectedServiceName. Azure Classic Subscription. 
    #ConnectedServiceNameARM: # string. Required when ConnectedServiceNameSelector = ConnectedServiceNameARM. Azure Subscription. 
    ScriptType: 'FilePath' # 'FilePath' | 'InlineScript'. Required. Script Type. Default: FilePath.
    #ScriptPath: # string. Optional. Use when ScriptType = FilePath. Script Path. 
    #Inline: # string. Optional. Use when ScriptType = InlineScript. Inline Script. 
    #ScriptArguments: # string. Script Arguments.

Inputs

ConnectedServiceNameSelector - Azure Connection Type
string. Allowed values: ConnectedServiceName (Azure Classic), ConnectedServiceNameARM (Azure Resource Manager). Default value: ConnectedServiceName.


ConnectedServiceName - Azure Classic Subscription
string. Required when ConnectedServiceNameSelector = ConnectedServiceName.

The Azure Classic subscription to configure before running PowerShell.


ConnectedServiceNameARM - Azure Subscription
string. Required when ConnectedServiceNameSelector = ConnectedServiceNameARM.

The Azure Resource Manager subscription to configure before running PowerShell.


ScriptType - Script Type
string. Required. Allowed values: FilePath (Script File Path), InlineScript (Inline Script). Default value: FilePath.

The type of the script: file path or inline.


ScriptPath - Script Path
string. Optional. Use when ScriptType = FilePath.

The path of the script. This should be a fully qualified path or one relative to the default working directory.


Inline - Inline Script
string. Optional. Use when ScriptType = InlineScript. Default value: # You can write your azure powershell scripts inline here. \n# You can also pass predefined and custom variables to this script using arguments.

Specifes the script to execute. The maximum supported inline script length is 500 characters. Use a script from a file if you want to use a longer script.


ScriptArguments - Script Arguments
string.

The additional parameters to pass to PowerShell. These can be either ordinal or named parameters.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands Self-hosted agents must have capabilities that match the following demands to run jobs that use this task: azureps
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 1.95.0 or greater
Task category Deploy