AzureCLI@1 - Azure CLI v1-taak

Voer Azure CLI-opdrachten uit op een Azure-abonnement in een shellscript wanneer u wordt uitgevoerd op een Linux-agent of batchscript wanneer u een Windows-agent uitvoert.

Deze taak wordt afgekeurd; Gebruik AzureCLI@2 of AzureCLI@3 in plaats daarvan.

Voer Azure CLI-opdrachten uit op een Azure-abonnement in een shellscript wanneer u wordt uitgevoerd op een Linux-agent of batchscript wanneer u een Windows-agent uitvoert.

Note

Er is een nieuwere versie van deze taak beschikbaar; Zie AzureCLI@2.

Syntaxis

# Azure CLI v1
# Deprecated: this task is no longer maintained. Use the AzureCLI@2 task instead.
- task: AzureCLI@1
  inputs:
    azureSubscription: # string. Alias: connectedServiceNameARM. Required. Azure subscription. 
    scriptLocation: 'scriptPath' # 'inlineScript' | 'scriptPath'. Required. Script Location. Default: scriptPath.
    scriptPath: # string. Required when scriptLocation = scriptPath. Script Path. 
    #inlineScript: # string. Required when scriptLocation = inlineScript. Inline Script. 
    #arguments: # string. Alias: args. Arguments. 
  # Advanced
    #addSpnToEnvironment: false # boolean. Access service principal details in script. Default: false.
    #useGlobalConfig: false # boolean. Use global Azure CLI configuration. Default: false.
    #workingDirectory: # string. Alias: cwd. Working Directory. 
    #failOnStandardError: false # boolean. Fail on Standard Error. Default: false.
# Azure CLI v1
# Run Azure CLI commands against an Azure subscription in a Shell script when running on Linux agent or Batch script when running on Windows agent.
- task: AzureCLI@1
  inputs:
    azureSubscription: # string. Alias: connectedServiceNameARM. Required. Azure subscription. 
    scriptLocation: 'scriptPath' # 'inlineScript' | 'scriptPath'. Required. Script Location. Default: scriptPath.
    scriptPath: # string. Required when scriptLocation = scriptPath. Script Path. 
    #inlineScript: # string. Required when scriptLocation = inlineScript. Inline Script. 
    #arguments: # string. Alias: args. Arguments. 
  # Advanced
    #addSpnToEnvironment: false # boolean. Access service principal details in script. Default: false.
    #useGlobalConfig: false # boolean. Use global Azure CLI configuration. Default: false.
    #workingDirectory: # string. Alias: cwd. Working Directory. 
    #failOnStandardError: false # boolean. Fail on Standard Error. Default: false.

Invoer

azureSubscription - Azure-abonnement
Invoeralias: connectedServiceNameARM. string. Verplicht.

Selecteert een Azure Resource Manager-abonnement voor de implementatie.


scriptLocation - scriptlocatie
string. Verplicht. Toegestane waarden: inlineScript (inlinescript), scriptPath (scriptpad). Standaardwaarde: scriptPath.

Selecteert de scriptlocatie.


scriptPath - scriptpad
string. Vereist wanneer scriptLocation = scriptPath.

Volledig gekwalificeerd pad van het script of een pad ten opzichte van de standaardwerkmap.


inlineScript - inlinescript
string. Vereist wanneer scriptLocation = inlineScript.

U kunt uw scripts hier inline schrijven. Wanneer u een Windows-agent gebruikt, gebruikt u batchscripting. Gebruik shellscripts bij het gebruik van agents op basis van Linux. Gebruik voor batchbestanden het voorvoegsel call vóór elke Azure-opdracht. U kunt ook vooraf gedefinieerde en aangepaste variabelen aan dit script doorgeven met behulp van argumenten

Zie de volgende voorbeelden. Het eerste is een shell-voorbeeld en de tweede is een batchvoorbeeld:

azure --version || azure account show 
call  azure --version || call azure account show

arguments - argumenten
Invoeralias: args. string.

Argumenten die zijn doorgegeven aan het script.


details van addSpnToEnvironment - Access-service-principal in script-
boolean. Standaardwaarde: false.

Hiermee voegt u de service-principal-id en sleutel toe van het Azure-eindpunt dat u hebt gekozen voor de uitvoeringsomgeving van het script. U kunt de variabelen $servicePrincipalId en $servicePrincipalKey in uw script gebruiken.

Dit wordt alleen uitgevoerd wanneer het Azure-eindpunt een verificatieschema voor service-principals heeft.


useGlobalConfig - globale Azure CLI-configuratie gebruiken
boolean. Standaardwaarde: false.

Als dit onwaar is, gebruikt deze taak een eigen afzonderlijke Azure CLI-configuratiemap. Dit kan worden gebruikt om Azure CLI-taken uit te voeren in parallelle releases.


workingDirectory - werkmap
Invoeralias: cwd. string.

Huidige werkmap waarin het script wordt uitgevoerd. Als u niets opgeeft, is deze invoer de hoofdmap van de opslagplaats (build) of artefacten (release), die $(System.DefaultWorkingDirectory).


failOnStandardError - mislukt bij standaardfout
boolean. Standaardwaarde: false.

Als deze invoer waar is, mislukt deze taak wanneer er fouten naar de StandardError-stroom worden geschreven. Schakel het selectievakje uit om standaardfouten te negeren en vertrouw in plaats daarvan op afsluitcodes om de status te bepalen.


Opties voor taakbeheer

Alle taken hebben besturingsopties naast hun taakinvoer. Zie Opties en algemene taakeigenschappenvoor meer informatie.

Uitvoervariabelen

Geen.

Opmerkingen

Note

Deze taak wordt afgekeurd; Gebruik AzureCLI@2 of AzureCLI@3 in plaats daarvan.

Note

Er is een nieuwere versie van deze taak beschikbaar; Zie AzureCLI@2.

Wat is er nieuw in versie 1.0:

  • Ondersteunt de nieuwe Azure CLI 2.0 die is gebaseerd op Python
  • Werkt met platformoverschrijdende agents (Linux, macOS of Windows)
  • Voor het werken met Azure CLI 1.0 (op basis vannode.js), schakelt u over naar taakversie 0.0
  • Beperkingen: - Geen ondersteuning voor klassieke Azure-abonnementen. Azure CLI 2.0 ondersteunt alleen ARM-abonnementen (Azure Resource Manager).

Vereisten

Voorwaarde Beschrijving
Pijplijntypen YAML, klassieke build, klassieke release
Wordt uitgevoerd op Agent, DeploymentGroup
eisen Geen
mogelijkheden Deze taak voldoet niet aan de vereisten voor volgende taken in de taak.
opdrachtbeperkingen Welk dan ook
variabelen instellen Welk dan ook
Agentversie 2.0.0 of hoger
Taakcategorie Implementeren