⚙️ Installation & Configuration
Deployment Api
📖 Docs

Deployment API - Optimizely DXP

Exam Area: Area 2 – Installation, Operation & Configuration (20%)
Source: https://academy.optimizely.com/student/path/3128969/activity/4970336
Published: Feb 14, 2026


Overview (Academy Key Points)

  • DXP is artifact-first: Build once, then deploy/promote the same package forward.
  • Promotion-based workflow: Integration → Preproduction → Production, no rebuild on promotion.
  • Deployment API + CLI: Pipelines authenticate, upload packages, validate, then promote.
  • Config is environment-scoped: Differences live in DXP configuration, not conditional code.

1. DXP Deployment Model (Academy – 4970336)

Promotion-based deployment — the same artifact is promoted forward:

1. dotnet publish → deployment artifact
2. epi cloud login → authenticate
3. Deploy to Integration → validate
4. epi cloud promote → Preproduction → UAT
5. epi cloud promote → Production

2. Build and Package (Academy – 4970336)

# Step 1: Publish the application
dotnet publish -c Release -o ./publish

# Step 2: Package for DXP (ZIP the output)
Compress-Archive -Path ./publish/* -DestinationPath ./deploy.zip

3. CLI Deployment Commands (Academy – 4970336)

# Authenticate
epi cloud login

# Deploy to Integration
epi cloud deploy --projectId <project-id> --environment Integration --package ./deploy.zip

# Promote Integration → Preproduction
epi cloud promote --projectId <project-id> --source Integration --target Preproduction

# Promote Preproduction → Production
epi cloud promote --projectId <project-id> --source Preproduction --target Production

4. Deployment API (REST)

Base URL: https://paasportal.episerver.net/api/v1.0

POST /deployments              → Start a new deployment
GET  /deployments/{id}         → Get deployment status
POST /deployments/{id}/reset   → Reset a deployment
GET  /environments             → List environments
POST /environments/{env}/slots → Manage slots (swap)

5. Authentication

# Client ID + Secret (from DXP Portal)
# Obtain an access token:
curl -X POST https://paasportal.episerver.net/api/v1.0/tokens \
  -H "Content-Type: application/json" \
  -d '{
    "clientId": "YOUR_CLIENT_ID",
    "clientSecret": "YOUR_CLIENT_SECRET"
  }'

6. PowerShell Automation (EpiCloud Module)

Install-Module -Name EpiCloud -Force

$config = Connect-EpiCloud -ClientKey $clientKey -ClientSecret $clientSecret

$deployment = Start-EpiDeployment `
  -ProjectId $projectId `
  -TargetEnvironment Integration `
  -DeploymentPackage $packagePath

# Wait for completion
Wait-EpiDeployment -Deployment $deployment

7. GitHub Actions Integration (Academy – 4970336)

name: Deploy to DXP Integration
on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Build and publish
        run: dotnet publish -c Release -o ./publish
        
      - name: Package
        run: zip -r deploy.zip ./publish
        
      - name: Authenticate with DXP
        run: epi cloud login
        env:
          EPI_CLOUD_CLIENT_SECRET: ${{ secrets.DXP_CLIENT_SECRET }}
          
      - name: Deploy to Integration
        run: epi cloud deploy --projectId ${{ secrets.DXP_PROJECT_ID }} --environment Integration --package ./deploy.zip

8. Slot Deployments

The Production environment can have:
  → Slot: Production (live)
  → Slot: Staging (test before swap)
  
Deploy to Staging → Test → Swap slots (zero-downtime)

9. Best Practices (Academy – 4970336)


Review Questions

  1. What does promotion-based deployment mean? (The same artifact is deployed forward — no rebuild)
  2. What is the command to build a deployment package? (dotnet publish -c Release -o ./publish)
  3. What is the command to authenticate with DXP? (epi cloud login)
  4. What is the command to promote from Integration to Preproduction? (epi cloud promote --source Integration --target Preproduction)
  5. Why should you not hardcode credentials in the pipeline? (Security — store as pipeline secrets and inject at runtime)
  6. What is the DXP Deployment API used for? (Automating deployments — CI/CD)
  7. What is the PowerShell module for DXP? (EpiCloud)
  8. What benefit does slot deployment provide? (Zero-downtime deployment via slot swap)