# Integrating Azure Pipelines

Source: https://www.jawsdeploy.net/guides/integrating-azure-pipelines

Azure Pipelines builds and tests, and Jaws Deploy handles releases and promotion.

Azure Pipelines connects to Jaws Deploy through a PowerShell task at the end of the build pipeline. Store the service account ID and API key as secret pipeline variables, or in an Azure DevOps variable group that every pipeline publishing to the same Jaws Deploy workspace can share.

## Final stage that creates a Jaws Deploy release

Reference the variable group from the pipeline:
```yaml
variables:
  - group: jaws-deploy
```

```
- stage: Release
  jobs:
  - job: CreateRelease
    pool:
      vmImage: 'windows-latest'
    steps:
    - task: PowerShell@2
      displayName: 'Create Jaws Deploy release'
      env:
        JAWS_API_LOGIN: $(JawsServiceAccountId)
        JAWS_API_PASSWORD: $(JawsApiKey)
      inputs:
        targetType: 'inline'
        pwsh: true
        script: |
          Import-Module ./JawsDeploySdk.psm1   # github.com/JawsDeploy/powershell-sdk
          New-JawsRelease `
              -projectId       "<project id>" `
              -version         "$(Build.BuildNumber)" `
              -packageVersions @{ "Checkout.Web" = "$(Build.BuildNumber)" }
```

## Self-hosted agents

The same task works on self-hosted Azure Pipelines agents. Install PowerShell 7 on the agent and make sure it can reach Jaws Deploy Cloud or your Stack server. On a restricted network, allow outbound HTTPS to that host.

