Azure-devops-docs: Facing issue in windows docker agent start.ps1 file.

Created on 15 May 2020  Â·  6Comments  Â·  Source: MicrosoftDocs/azure-devops-docs

  1. Determining matching Azure Pipelines agent...
    Invoke-RestMethod : An error occurred while sending the request.
    At C:\azp\start.ps1:32 char:12
  2. $package = Invoke-RestMethod -Headers @{Authorization=("Basic $base64 ...
  3. ~~~~~~~~~~~~~~

    • CategoryInfo : InvalidOperation: (Method: GET, Re...1.14393.100

      0

      }:HttpRequestMessage) [Invoke-RestMethod], HttpRequestException

    • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe

      ll.Commands.InvokeRestMethodCommand

Cannot index into a null array.
At C:\azp\start.ps1:33 char:1

  • $packageUrl = $package[0].Value.downloadUrl
  • ~~~~~~~~~~~

    • CategoryInfo : InvalidOperation: (:) [], RuntimeException

    • FullyQualifiedErrorId : NullArray

  1. Downloading and installing Azure Pipelines agent...
    New-Object : Cannot find type [System.Net.WebClient]: verify that the assembly
    containing this type is loaded.
    At C:\azp\start.ps1:39 char:7
  2. $wc = New-Object System.Net.WebClient
  3. ~~~~~~~

    • CategoryInfo : InvalidType: (:) [New-Object], PSArgumentExcepti

      on

    • FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewOb

      jectCommand

You cannot call a method on a null-valued expression.
At C:\azp\start.ps1:40 char:34

  • $wc.DownloadFile($packageUrl, "$(Get-Location)\agent.zip")
  • ~~~~

    • CategoryInfo : InvalidOperation: (:) [], RuntimeException

    • FullyQualifiedErrorId : InvokeMethodOnNull

Expand-Archive : The path 'agent.zip' either does not exist or is not a valid
file system path.
At C:\azp\start.ps1:42 char:1

  • Expand-Archive -Path "agent.zip" -DestinationPath "\azp\agent"
  • ~~~~~~~~~~~~~~

    • CategoryInfo : InvalidArgument: (agent.zip:String) [Expand-Arch

      ive], InvalidOperationException

    • FullyQualifiedErrorId : ArchiveCmdletPathNotFound,Expand-Archive

  1. Configuring Azure Pipelines agent...
    Cleanup. Removing Azure Pipelines agent...
    .\config.cmd : The term '.\config.cmd' is not recognized as the name of a
    cmdlet, function, script file, or operable program. Check the spelling of the
    name, or if a path was included, verify that the path is correct and try again.
    At C:\azp\start.ps1:68 char:3
  2. .\config.cmd remove --unattended `
  3. ~~~~

    • CategoryInfo : ObjectNotFound: (.\config.cmd:String) [], Comman

      dNotFoundException

    • FullyQualifiedErrorId : CommandNotFoundException

.\config.cmd : The term '.\config.cmd' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At C:\azp\start.ps1:48 char:3

  • .\config.cmd --unattended `
  • ~~~~

    • CategoryInfo : ObjectNotFound: (.\config.cmd:String) [], Comman

      dNotFoundException

    • FullyQualifiedErrorId : CommandNotFoundException


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri1 cba devops-cicd-agenttech devopprod support-request

All 6 comments

You need to enable TLS 1.2 by adding the following line to the top of your Start.ps1 script

@atedsimple I have enabled TLS 1.2 as u have asked, now it is throwing different error.

  1. Determining matching Azure Pipelines agent...
    https://vstsagentpackage.azureedge.net/agent/2.168.2/vsts-agent-win-x64-2.168.2.zip
  2. Downloading and installing Azure Pipelines agent...
    New-Object : Cannot find type [System.Net.WebClient]: verify that the assembly
    containing this type is loaded.
    At C:\azp\start.ps1:39 char:7
  3. $wc = New-Object System.Net.WebClient
  4. ~~~~~~~

    • CategoryInfo : InvalidType: (:) [New-Object], PSArgumentExcepti

      on

    • FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewOb

      jectCommand

You cannot call a method on a null-valued expression.
At C:\azp\start.ps1:40 char:34

  • $wc.DownloadFile($packageUrl, "$(Get-Location)\agent.zip")
  • ~~~~

    • CategoryInfo : InvalidOperation: (:) [], RuntimeException

    • FullyQualifiedErrorId : InvokeMethodOnNull

Expand-Archive : The path 'agent.zip' either does not exist or is not a valid
file system path.
At C:\azp\start.ps1:42 char:1

  • Expand-Archive -Path "agent.zip" -DestinationPath "\azp\agent"
  • ~~~~~~~~~~~~~~

    • CategoryInfo : InvalidArgument: (agent.zip:String) [Expand-Arch

      ive], InvalidOperationException

    • FullyQualifiedErrorId : ArchiveCmdletPathNotFound,Expand-Archive

  1. Configuring Azure Pipelines agent...
    Cleanup. Removing Azure Pipelines agent...
    .\config.cmd : The term '.\config.cmd' is not recognized as the name of a
    cmdlet, function, script file, or operable program. Check the spelling of the
    name, or if a path was included, verify that the path is correct and try again.
    At C:\azp\start.ps1:68 char:3
  2. .\config.cmd remove --unattended `
  3. ~~~~

    • CategoryInfo : ObjectNotFound: (.\config.cmd:String) [], Comman

      dNotFoundException

    • FullyQualifiedErrorId : CommandNotFoundException

.\config.cmd : The term '.\config.cmd' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At C:\azp\start.ps1:48 char:3

  • .\config.cmd --unattended `
  • ~~~~

    • CategoryInfo : ObjectNotFound: (.\config.cmd:String) [], Comman

      dNotFoundException

    • FullyQualifiedErrorId : CommandNotFoundException

Seems like you don't have the correct versions of Framework in your base docker image
Have a look at what we use to build the Docker Image for both 2016 and 2019 server
https://docs.modalitysoftware.com/vsts-agent/customise.html

@atedsimple thanks.

@ashutoshbarve Thank you for the question.

@atedsimple Thank you for providing a solution, consider becoming a contributor.

For further issues, please provide a reference to the specific documentation example and we will assign an author for review.

To receive general support, refer to the Azure DevOps support page.

Closing this issue now.

Was this page helpful?
0 / 5 - 0 ratings