none
configure VSTS vsTest - testAssemblies agent with custom settings RRS feed

  • Question

  • Dears

    Please help me with VSTS test build task configuration.

    I've configured build in VSTS project and try to configure Visual Studio Test task.

    My code uses x509 certificates to sign some data. Current source code uses Windows certificate store as certificate store. So all my tests expects that certificate used for signature creation is loaded from Local machine\Personal certificate store.

    However I've failed to upload certificate to the VSTS instance. I'm not able to find such option. 

    Could you please help me with some additional information about Test task configuration approach that is used. I see that it has a lot of configurations that is related to paths and config files. 

    Should I change my certificate store algorithm for tests and rewrite them to load certificate from file, like in Java? This can be done without problem because I'm using test self-issued certificate and there is no security issue.

    But I'd like to know is it possible to upload test certificate to the windows certificate store before tests task will run ?


    Regards

    Monday, November 27, 2017 1:52 PM

All replies

  • Hi,

    You can try to import the certificate through PowerShell script:

    $pfxpath = 'pathtoees.pfx'
    $password = 'password'
    
    Add-Type -AssemblyName System.Security
    $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
    $cert.Import($pfxpath, $password, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]"PersistKeySet")
    $store = new-object system.security.cryptography.X509Certificates.X509Store -argumentlist "MY", CurrentUser
    $store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]"ReadWrite")
    $store.Add($cert)
    $store.Close()

    https://stackoverflow.com/questions/43547231/visual-studio-team-services-deploymen-buildt-certificate-error


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, November 28, 2017 8:04 AM
    Moderator
  • Thank you for hint

    seems that i do not have enough permissions to run custom agent for evaluated permissions https://docs.microsoft.com/en-us/vsts/build-release/actions/agents/v2-windows#Runtheagent 

    I've disabled tests task and will test it locally (despite it sucks)


    Regards

    Wednesday, November 29, 2017 12:36 PM
  • Hi,

    Could you use Hosted agent? Regarding private agent, you can ask others to setup private build agent if you don't have the permission.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, November 30, 2017 6:26 AM
    Moderator
  • Hi

    Sure I'm using hosted agent to run vsts build

    It is impossible to run hosted agent in evaluated mode (https://docs.microsoft.com/en-us/vsts/build-release/concepts/agents/hosted)

    However it is not clear for me what should be done after "dowload agent"  (https://docs.microsoft.com/en-us/vsts/build-release/actions/agents/v2-windows)

    I've downloaded Windows agent but there is no special instructions on the page, only zip file

    Also i do not understand custom agent concept a little bit. What is it? Where is it hosted? Is it running locally (since i've downloaded it)?



    Regards

    Thursday, November 30, 2017 8:45 AM
  • Hi,

    What do you mean evaluated mode? Do you mean interactive mode?

    Regarding private agent, you need to extract the zip file>Run Command Line as administrator>Call config.cmd in that folder. After configuring it, you can choose private agent pool when queue build and it is running locally (agent machine)


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, December 1, 2017 8:17 AM
    Moderator