Observação
O acesso a essa página exige autorização. Você pode tentar entrar ou alterar diretórios.
O acesso a essa página exige autorização. Você pode tentar alterar os diretórios.
Use essa tarefa para executar um script do PowerShell em um ambiente do Azure. O contexto do Azure é autenticado com a conexão de serviço Azure Resource Manager fornecida.
Esta versão da tarefa foi preterida; use AzurePowerShell@5.
Use essa tarefa para executar um script do PowerShell em um ambiente do Azure. O contexto do Azure é autenticado com a conexão de serviço Azure Resource Manager fornecida.
Sintaxe
# Azure PowerShell v3
# Run a PowerShell script within an Azure environment.
- task: AzurePowerShell@3
inputs:
#azureConnectionType: 'ConnectedServiceNameARM' # 'ConnectedServiceName' | 'ConnectedServiceNameARM'. Alias: ConnectedServiceNameSelector. Azure Connection Type. Default: ConnectedServiceNameARM.
#azureClassicSubscription: # string. Alias: ConnectedServiceName. Required when ConnectedServiceNameSelector = ConnectedServiceName. Azure Classic Subscription.
azureSubscription: # string. Alias: ConnectedServiceNameARM. Required when ConnectedServiceNameSelector = ConnectedServiceNameARM. Azure Subscription.
#ScriptType: 'FilePath' # 'FilePath' | 'InlineScript'. Script Type. Default: FilePath.
#ScriptPath: # string. Optional. Use when ScriptType = FilePath. Script Path.
#Inline: # string. Optional. Use when ScriptType = InlineScript. Inline Script.
#ScriptArguments: # string. Optional. Use when ScriptType = FilePath. Script Arguments.
#errorActionPreference: 'stop' # 'stop' | 'continue' | 'silentlyContinue'. ErrorActionPreference. Default: stop.
#FailOnStandardError: false # boolean. Fail on Standard Error. Default: false.
# Azure PowerShell version options
#azurePowerShellVersion: 'OtherVersion' # 'LatestVersion' | 'OtherVersion'. Alias: TargetAzurePs. Azure PowerShell Version. Default: OtherVersion.
preferredAzurePowerShellVersion: # string. Alias: CustomTargetAzurePs. Required when TargetAzurePs = OtherVersion. Preferred Azure PowerShell Version.
# Advanced
#validateScriptSignature: false # boolean. Optional. Use when ScriptType = FilePath. Validate script signature. Default: false.
# Azure PowerShell v3
# Run a PowerShell script within an Azure environment.
- task: AzurePowerShell@3
inputs:
#azureConnectionType: 'ConnectedServiceNameARM' # 'ConnectedServiceName' | 'ConnectedServiceNameARM'. Alias: ConnectedServiceNameSelector. Azure Connection Type. Default: ConnectedServiceNameARM.
#azureClassicSubscription: # string. Alias: ConnectedServiceName. Required when ConnectedServiceNameSelector = ConnectedServiceName. Azure Classic Subscription.
azureSubscription: # string. Alias: ConnectedServiceNameARM. Required when ConnectedServiceNameSelector = ConnectedServiceNameARM. Azure Subscription.
#ScriptType: 'FilePath' # 'FilePath' | 'InlineScript'. Script Type. Default: FilePath.
#ScriptPath: # string. Optional. Use when ScriptType = FilePath. Script Path.
#Inline: # string. Optional. Use when ScriptType = InlineScript. Inline Script.
#ScriptArguments: # string. Optional. Use when ScriptType = FilePath. Script Arguments.
#errorActionPreference: 'stop' # 'stop' | 'continue' | 'silentlyContinue'. ErrorActionPreference. Default: stop.
#FailOnStandardError: false # boolean. Fail on Standard Error. Default: false.
# Azure PowerShell version options
#azurePowerShellVersion: 'OtherVersion' # 'LatestVersion' | 'OtherVersion'. Alias: TargetAzurePs. Azure PowerShell Version. Default: OtherVersion.
preferredAzurePowerShellVersion: # string. Alias: CustomTargetAzurePs. Required when TargetAzurePs = OtherVersion. Preferred Azure PowerShell Version.
Entradas
azureConnectionType
-
tipo de conexão do Azure
Alias de entrada: ConnectedServiceNameSelector.
string. Valores permitidos: ConnectedServiceName (Azure Classic), ConnectedServiceNameARM (Azure Resource Manager). Valor padrão: ConnectedServiceNameARM.
azureClassicSubscription
-
de Assinatura Clássica do Azure
Alias de entrada: ConnectedServiceName.
string. Necessário quando ConnectedServiceNameSelector = ConnectedServiceName.
A assinatura do Azure Classic a ser configurada antes de executar o PowerShell.
azureSubscription
-
assinatura do Azure
Alias de entrada: ConnectedServiceNameARM.
string. Necessário quando ConnectedServiceNameSelector = ConnectedServiceNameARM.
A assinatura do Azure Resource Manager a ser configurada antes de executar o PowerShell.
ScriptType
-
tipo de script
string. Valores permitidos: FilePath (caminho do arquivo de script), InlineScript (script embutido). Valor padrão: FilePath.
O tipo do script: caminho do arquivo ou embutido.
ScriptPath
-
caminho de script
string. Opcional. Use quando ScriptType = FilePath.
O caminho do script. Esse deve ser um caminho totalmente qualificado ou um relativo ao diretório de trabalho padrão.
Inline
-
script embutido
string. Opcional. Use quando ScriptType = InlineScript. Valor padrão: # You can write your azure powershell scripts inline here. \n# You can also pass predefined and custom variables to this script using arguments.
Especifica o script a ser executado. O comprimento máximo de script embutido com suporte é de 5.000 caracteres. Use um script de um arquivo se quiser usar um script mais longo.
argumentos de script ScriptArguments -
string. Opcional. Use quando ScriptType = FilePath.
Os parâmetros adicionais a serem passados para o PowerShell. Eles podem ser parâmetros ordinais ou nomeados.
ErrorActionPreference errorActionPreference -
string. Valores permitidos: stop, continue, silentlyContinue. Valor padrão: stop.
Seleciona o valor da variável ErrorActionPreference para executar o script.
FailOnStandardError
-
falha no de erro padrão
boolean. Valor padrão: false.
Quando isso for verdadeiro, essa tarefa falhará se algum erro for gravado no pipeline de erros ou se algum dado for gravado no fluxo de erros padrão.
azurePowerShellVersion
-
versão do Azure PowerShell
Alias de entrada: TargetAzurePs.
string. Valores permitidos: LatestVersion (versão mais recente instalada), OtherVersion (especificar outra versão). Valor padrão: OtherVersion.
No caso de agentes hospedados, as versões do Azure PowerShell com suporte são 2.1.0, 3.8.0, 4.2.1, 5.1.1 e 6.7.0.
Para escolher a versão mais recente disponível no agente, selecione LatestVersion (versão mais recente instalada).
Para agentes privados, você pode especificar uma versão preferencial do Azure PowerShell usando OtherVersion (especifique outra versão).
preferredAzurePowerShellVersion
-
versão preferencial do Azure PowerShell
Alias de entrada: CustomTargetAzurePs.
string. Necessário quando TargetAzurePs = OtherVersion.
A versão preferencial do Azure PowerShell precisa ser uma versão semântica adequada, por exemplo.
1.2.3.. Não há suporte para Regex como 2.\*,2.3.\*. Atualmente, os agentes hospedados dão suporte às versões do módulo do Azure 2.1.0, 3.8.0, 4.2.1, 5.1.1 e versões do módulo AzureRM 2.1.0, 3.8.0, 4.2.1, 5.1.1, 6.7.0.
validateScriptSignature
-
Validar de assinatura de script
boolean. Opcional. Use quando ScriptType = FilePath. Valor padrão: false.
Se isso for verdadeiro, a tarefa primeiro verificará se o script especificado está assinado e válido antes de executá-lo.
Opções de controle de tarefa
Todas as tarefas têm opções de controle além das suas entradas de tarefas. Para obter mais informações, consulte as opções de Controle de e as propriedades comuns da tarefa.
Variáveis de saída
Nenhum.
Observações
Adicionado suporte para Fail on standard error and ErrorActionPreference.
Requisitos
| Requisito | Descrição |
|---|---|
| Tipos de pipeline | YAML, build clássico, versão clássica |
| Execuções em | Agent, DeploymentGroup |
| de demandas | Os agentes auto-hospedados devem ter recursos que correspondam às seguintes demandas de para executar trabalhos que usam esta tarefa: azureps |
| recursos | Essa tarefa não atende a nenhuma demanda para tarefas subsequentes no trabalho. |
| restrições de comando | Qualquer |
| variáveis settable | Qualquer |
| Versão do agente | 2.0.0 ou superior |
| Categoria de tarefa | Implantar |