steps:
  - task: DownloadBuildArtifacts@0
    displayName : 'Download Extension wheel from Build Artifacts'
    inputs:
      buildType: 'current'
      downloadType: 'single'
      artifactName: 'azure-devops-cli-extension'
      downloadPath: '$(System.ArtifactsDirectory)/extension'

  - task: PowerShell@2
    displayName: 'Install Downloaded Extension'
    inputs:
      targetType: 'inline'
      script: |
        $extensionUninstall = az extension remove -n azure-devops
        $extensions = Get-ChildItem -Filter "*.whl" -Recurse | Select-Object FullName
        Foreach ($extension in $extensions)
        {
            Write-Host "installing " $extension.FullName
            az extension add --source $extension.FullName -y --debug
        }
        Write-Host "done"
      workingDirectory: '$(System.ArtifactsDirectory)/extension'
