I m facing an issue with Compress-Archive cmd line. I need to compress drop files (some files) and push compressed .rar to Azure blob storage.
In VSTS we have default compress task & which does for me, but in TFS 2015 I m using powershell cmd
Compress-Archive -Path $(Build.ArtifactStagingDirectory)\* -DestinationPath $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
I ended up . with error
2018-06-26T17:29:08.5918176Z Generating script.
2018-06-26T17:29:08.5918734Z Formatted command: . 'D:\a\1\s\arch.ps1'
2018-06-26T17:29:09.3003116Z ##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a_temp\e2b5fc08-c599-49ec-bbd6-8a4a69f8d977.ps1'"
2018-06-26T17:29:14.3345598Z Build.ArtifactStagingDirectory : The term 'Build.ArtifactStagingDirectory' is not recognized as the name of a cmdlet,
2018-06-26T17:29:14.3345966Z function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
2018-06-26T17:29:14.3346099Z path is correct and try again.
2018-06-26T17:29:14.3346952Z At D:\a\1\s\arch.ps1:5 char:47
2018-06-26T17:29:14.3347355Z + ... e -Path .* -DestinationPath $(Build.ArtifactStagingDirectory)/$(Buil ...
2018-06-26T17:29:14.3348520Z + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2018-06-26T17:29:14.3348782Z + CategoryInfo : ObjectNotFound: (Build.ArtifactStagingDirectory:String) [], ParentContainsErrorRecordExc
2018-06-26T17:29:14.3348968Z eption
2018-06-26T17:29:14.3349135Z + FullyQualifiedErrorId : CommandNotFoundException
2018-06-26T17:29:14.3349466Z
2018-06-26T17:29:14.5676478Z ##[error]PowerShell exited with code '1'.
How can I access build variables within my powershell script ? could someone guide me please ?