Skip to content

Latest commit

 

History

History
178 lines (139 loc) · 6.46 KB

azure-powershell-v1.md

File metadata and controls

178 lines (139 loc) · 6.46 KB
title description ms.date monikerRange
AzurePowerShell@1 - Azure PowerShell v1 task
Run a PowerShell script within an Azure environment (task version 1).
05/14/2024
<=azure-pipelines

AzurePowerShell@1 - Azure PowerShell v1 task

:::moniker range="<=azure-pipelines"

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.

:::moniker-end

Syntax

:::moniker range=">=azure-pipelines-2019"

# 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.

:::moniker-end

Inputs

:::moniker range="<=azure-pipelines"

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


:::moniker-end

:::moniker range="<=azure-pipelines"

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

The Azure Classic subscription to configure before running PowerShell.


:::moniker-end

:::moniker range="<=azure-pipelines"

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

The Azure Resource Manager subscription to configure before running PowerShell.


:::moniker-end

:::moniker range="<=azure-pipelines"

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.


:::moniker-end

:::moniker range="<=azure-pipelines"

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.


:::moniker-end

:::moniker range="<=azure-pipelines"

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.


:::moniker-end

:::moniker range="<=azure-pipelines"

ScriptArguments - Script Arguments
string.

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


:::moniker-end

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

:::moniker range="<=azure-pipelines"

None.

:::moniker-end

Requirements

:::moniker range="<=azure-pipelines"

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

:::moniker-end