Skip to content

[enhancement]: Add Login Cache to Azure CLI Task #21168

@LPVRamos

Description

@LPVRamos

Task name

AzureCLI@2

Describe your feature request here

Enhancement
Add login caching to AzureCLI Task so that multiple calls to same azureSubscription do not trigger a re-login.

Context

Me and my team are working on a product that deploys several resources to Azure. In doing so our pipeline looks something like this:

- ${{ each resource in parameters.resources }}:
  - task: AzureCLI@2
    displayName: "Apply Resource ${{ resource}} settings"
    inputs:
      azureSubscription: 'some-connection'
      scriptType: 'bash'
      scriptLocation: 'inlineScript'
      inlineScript: |
        ...apply settings to azure resource
              
  #Deploy WebApp (example)
   - task: AzureWebApp@1
     displayName: "Deploy ${{ resource }}"
     inputs:
       azureSubscription: 'some-connection'
       appType: 'type'
       appName: ${{ resource }}
       resourceGroupName: 'some-group'
       package: 'some-directory'

   - task: AzureCLI@2
     displayName: "Extra settings that can only be done after deployment"
     inputs:
       azureSubscription: 'some-connection'
       scriptType: 'bash'
       scriptLocation: 'inlineScript'
       inlineScript: |
         ...apply extra settings to azure resource

The number of resources in question are 10+. This leads to 20+ azure login requests that take about 15 seconds each, totaling at around 5+ minutes per deployment.

My enhancement request would bring this down to a total of 1 request to azure login in this case.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions