1

I'm trying to run and connect to azurite from Azure DevOps pipelines. This is how my pipeline looks like

trigger:
  - '*'

stages:
  - stage: 'test'
    displayName: 'test'
    jobs:
     - job: 'Build_job'
       displayName: 'Build job'
       pool:
         vmImage: 'windows-2022'
       steps:
              
          - task: NodeTool@0
            displayName: 'Use Node.js'
            inputs:
              versionSpec: '16.*'

          - task: PowerShell@2
            displayName: 'Install and launch Azurite'
            inputs:
              targetType: 'inline'
              script: |
                npm install -g azurite 
                mkdir c:/azurite
                Start-Job -ScriptBlock { azurite --silent --location c:\azurite --debug c:\azurite\debug.log  }
              pwsh: true

          - task: PowerShell@2
            displayName: 'Check Azurite availability'
            inputs:
              targetType: 'inline'
              script: |
                curl 127.0.0.1:10000
                curl localhost:10000
              pwsh: true

It fails on the availability check. enter image description here

The same pipeline works fine on the ubuntu image, but my project has some dependencies on Windows. How can I connect to azurite on windows image?

2 Answers2

0

As you use the shared Microsoft windows agent you cannot perform ports connectivity as it is prohibited from Microsoft for these resources. You will need to install the tooling on a private agent to perform the same tasks.

You can verify this by taking the output from netstat about listening ports.

netstat -ano | findstr "LISTENING"

enter image description here

Attaching same answers:

How to open TCP port on localhost on VSTS build agent?

Azure Devops azure pipelines agents TCP connection failing

GeralexGR
  • 2,973
  • 6
  • 24
  • 33
0

I did get this working with a windows-2022 host

Some help https://github.com/Azure-Samples/automated-testing-with-azurite/tree/main, though did need to remove sudo and also make it not log as the logging was making my publish artefacts fail.

My modifiedstep is:

        - bash: |
        npm install -g azurite
        mkdir azurite
        azurite --silent --location azurite &
      displayName: 'Install and Run Azurite'
lesma
  • 19
  • 5