Nota
O acesso a esta página requer autorização. Podes tentar iniciar sessão ou mudar de diretório.
O acesso a esta página requer autorização. Podes tentar mudar de diretório.
Use esta tarefa para executar um script do PowerShell em um ambiente do Azure. O contexto do Azure é autenticado com a ligação do serviço do Azure Resource Manager fornecida.
Esta versão da tarefa foi preterida; use AzurePowerShell@5.
Use esta tarefa para executar um script do PowerShell em um ambiente do Azure. O contexto do Azure é autenticado com a ligação do serviço do 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.
Insumos
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 Subscrição 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
-
Subscrição 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 do script
string. Opcional. Use quando ScriptType = FilePath.
O caminho do script. Este deve ser um caminho totalmente qualificado ou relativo ao diretório de trabalho padrão.
Inline
-
Script Inline
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 suportado é de 5000 caracteres. Use um script de um arquivo se quiser usar um script mais longo.
ScriptArguments
-
Argumentos de script
string. Opcional. Use quando ScriptType = FilePath.
Os parâmetros adicionais a serem passados para o PowerShell. Estes 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 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 erro padrão.
azurePowerShellVersion
-
Versão do Azure PowerShell
Alias de entrada: TargetAzurePs.
string. Valores permitidos: LatestVersion (Última versão 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 instalada mais recente).
Para agentes privados, você pode especificar uma versão preferencial do Azure PowerShell usando OtherVersion (Especificar outra versão).
preferredAzurePowerShellVersion
-
Versão Preferencial do Azure PowerShell
Alias de entrada: CustomTargetAzurePs.
string. Necessário quando TargetAzurePs = OtherVersion.
A versão preferida do Azure PowerShell precisa ser uma versão semântica adequada, por exemplo.
1.2.3.. Regex como 2.\*,2.3.\* não é suportado. 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 AzureRM versões do módulo 2.1.0, 3.8.0, 4.2.1, 5.1.1, 6.7.0.
validateScriptSignature
-
Validar assinatura de script
boolean. Opcional. Use quando ScriptType = FilePath. Valor padrão: false.
Se isso for verdade, a tarefa primeiro verificará se o script especificado está assinado e é válido antes de executá-lo.
Opções de controlo de tarefas
Todas as tarefas têm opções de controle, além de suas entradas de tarefas. Para obter mais informações, consulte Opções de controle de e propriedades de tarefas comuns.
Variáveis de saída
Nenhum.
Observações
Adicionado suporte para Fail on standard error e ErrorActionPreference.
Requerimentos
| Requisito | Descrição |
|---|---|
| Tipos de pipeline | YAML, Construção clássica, Versão clássica |
| Funciona em | Agente, DeploymentGroup |
| Exigências | Os agentes auto-hospedados devem ter recursos que correspondam às seguintes demandas executar trabalhos que usam essa tarefa: azureps |
| Capacidades | Esta tarefa não satisfaz quaisquer exigências para tarefas subsequentes no trabalho. |
| Restrições de comando | Qualquer |
| Variáveis configuráveis | Qualquer |
| Versão do agente | 2.0.0 ou superior |
| Categoria de tarefa | Desplegar |