Dev Guide

Setting up Resources and Pipelines
for Rio Evo

A step-by-step guide for developers setting up a new service in the Rio Evo ecosystem — covering branch creation, Terraform scaffolding, and all four pipeline configurations.

Before you start: Details of which repository to use should be provided on the ADO ticket. If you encounter errors at any pipeline stage, run it through Devin — provide your specific repo name, branch, and file name for the best assistance.
Part 1 — Branch & Repository Setup
1
Create a new branch to work from

Use Devin to create a new branch for your repository. Provide the repo name and a suitable branch name.

Devin prompt to create a new branch for Services.Allergies
Devin prompt: "Create me a new branch for the following repo. Service.Allergies" — branch name: ADO/2529301/create-environments
Branch selection dropdown showing the new branch
Branch selection dropdown showing the newly created branch alongside existing branches
2
Clone the repo to use in VS Code

Switch to your new branch in Azure Repos and press Clone.

Azure Repos file browser with Clone button highlighted
Azure Repos — switch to your branch and click the Clone button (top right)

In the Clone Repository dialog, select Clone in VS Code.

Clone Repository dialog with Clone in VS Code button highlighted
Clone Repository dialog — use the SSH URL and click "Clone in VS Code"

When prompted, select your destination folder (e.g. your RioEvo folder).

VS Code folder selection dialog for clone destination
VS Code folder selection — navigate to your RioEvo folder and click "Select as Repository Destination"
3
Change to your repo and branch in VS Code

Once cloned, confirm VS Code is on the correct repo and branch. Check the breadcrumb at the top of the explorer.

VS Code breadcrumb showing Services.Allergies and branch ADO/2529301/create-environments
VS Code breadcrumb confirming: Services.Allergies › ADO/2529301/create-environments
Part 2 — Terraform Scaffolding
4
Download the Terraform script and place it in your folder

Download New-TerraformService.ps1 from the TerraformScript Repos location and place it into the root of your cloned repository folder.

VS Code file explorer showing cloned repo structure with New-TerraformService.ps1
File explorer showing the cloned repo structure — New-TerraformService.ps1 placed in the root alongside other config files
5
Open a terminal in VS Code and run the script

Open a terminal in VS Code and run the PowerShell script:

.\New-TerraformService.ps1
Execution Policy Error? If you see the message below, the script is not digitally signed and cannot run under the current policy.
PowerShell execution policy error for New-TerraformService.ps1
Error: "File cannot be loaded. The file is not digitally signed. You cannot run this script on the current system."

Run this command first, then try again:

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
PowerShell terminal showing Set-ExecutionPolicy command and script execution
Running Set-ExecutionPolicy Bypass, then re-running the script

The script will prompt for a ServiceName. Enter your service name (e.g. allergies).

PowerShell prompt for ServiceName parameter
Script prompts: "Supply values for the following parameters: ServiceName:"
ServiceName entered as 'allergies'
Enter your service name — in this example: allergies

The script will scaffold the Terraform files and confirm completion:

PowerShell terminal showing scaffold complete output with all generated files listed
Scaffold complete — all Terraform files, backend configs, variables, and pipeline YAML files are generated

Check the generated files carefully. Pay particular attention to the tfbackend files — the script sometimes adds an extra 's' to the service name which is incorrect.

VS Code showing dev.tfbackend with 'are-allergiess-dev-ukw.tfstate' — extra s highlighted
Check dev.tfbackend (and test/prod): the key value may incorrectly read are-allergiess-dev-ukw.tfstate — remove the extra 's'
DEV only note: We are currently only setting up for DEV. Comment out the TEST and PROD sections in the following files until they are needed:

frontend/azure/build-and-deploy.yml — comment out the Deploy Test section:

build-and-deploy.yml with Deploy Test section commented out
build-and-deploy.yml — Deploy Test stage commented out (lines 94–120 shown commented with #)

terraform/azure/deploy-terraform.yml — comment out the Test Plan and Test Apply sections:

deploy-terraform.yml with Test Plan section commented out
deploy-terraform.yml — Test Plan and subsequent stages commented out
6
Commit the changes to the branch

Commit all staged changes to your branch. Do not commit the PowerShell script (New-TerraformService.ps1) — leave it out of the commit.

VS Code Source Control showing 11 staged changes with commit message
Stage all generated files (11 files) with commit message e.g. "internal: adding scripts for setup #2529301" — ensure New-TerraformService.ps1 is NOT staged

After committing, sync the branch by pressing the sync button at the bottom of VS Code.

VS Code status bar showing sync button with 0 down 11 up
Press the sync button (↑↓) in the VS Code status bar to push your commit to the remote branch
Part 3 — Terraform Pipeline
7
Create the Terraform pipeline

Navigate to the Terraform > Rio Evo folder in Pipelines. Create a new folder for your product (e.g. Allergies).

Azure DevOps Pipelines showing Terraform > Rio Evo folder structure
Navigate to Terraform › Rio Evo in the Pipelines folder tree
New folder dialog with 'Allergies' entered under Terraform\Rio Evo
Create a new folder named after your product (e.g. "Allergies") under \Terraform\Rio Evo\
Rio Evo > Allergies folder shown as empty with 'Create a new pipeline here' link
The new Allergies folder is empty — click "Create a new pipeline here"

Follow the pipeline creation wizard:

Step 1 — Connect: Select Azure Repos Git

New pipeline wizard: Where is your code? — Azure Repos Git highlighted
Select "Azure Repos Git (YAML)" as the source

Step 2 — Select: Search for and select your repository

Select a repository — searching 'aller' showing Services.Allergies
Search for your repo (e.g. "aller") and select it from the results

Step 3 — Configure: Select Existing Azure Pipelines YAML file

Configure step — Existing Azure Pipelines YAML file option highlighted
Choose "Existing Azure Pipelines YAML file" at the bottom of the Configure list

Step 4 — Select branch and path: Choose your working branch, then select the YAML file path

Select an existing YAML file dialog — branch ADO/2529301/create-environments selected
Select your branch (e.g. ADO/2529301/create-environments) from the Branch dropdown
Path dropdown showing /terraform/azure/deploy-terraform.yml highlighted
Select /terraform/azure/deploy-terraform.yml from the Path dropdown

Press the dropdown arrow next to Run and select Save (do not run yet).

Save button highlighted in the Run dropdown
Click the arrow next to "Run" and select "Save" to save without running
8
Verify the resource group does not yet exist in Azure

Before running the pipeline, confirm the resource group doesn't already exist. Go to Azure Resource Manager and filter by your service name and the HSC - RioReimagined - Dev subscription.

Azure Resource Manager filtered by 'aller' and HSC RioReimagined Dev subscription showing no results
Filter by your service name (e.g. "aller") and the Dev subscription — confirm "No resource groups match your filters"
9
Run the Terraform pipeline — Plan Only (trial run)

Run the pipeline for the first time with Plan Only (skip Apply) ticked to verify what will be created without making any changes.

Select your branch in the pipeline version selector:

Run pipeline dialog — branch ADO/2529301/create-environments selected
Select your working branch (e.g. ADO/2529301/create-environments) as the pipeline version

Ensure Plan Only (skip Apply) is ticked, then press Run:

Run pipeline parameters — dev selected, Plan Only ticked
Set Target Environment to dev and tick Plan Only (skip Apply) for the first run

On the first run you will need to grant permissions. Click View when the permission warning appears:

Pipeline permission warning banner — Dev Plan stage waiting
Permission warning: "This pipeline needs permission to access 2 resources before this run can continue to Dev - Plan" — click View

Permit all listed resources:

Waiting for review dialog showing Repository Rio.SharedResources and Variable group are-terraform needing permission
Click Permit for both: Repository (Rio.SharedResources) and Variable group (are-terraform)

Wait for the pipeline to complete. Check the Terraform Plan step to review what resources will be created:

Dev Plan stage completed — Terraform Plan (Dev) job showing all steps green
Dev - Plan stage completed successfully — all steps including Terraform Plan show green ticks

Review the Terraform Plan output to confirm the correct resource group name:

Terraform plan output showing resource_group_name = are-allergies-dev-ukw-rg-01
Terraform Plan output — confirm the resource_group_name matches your expected naming convention (e.g. are-allergies-dev-ukw-rg-01)
10
Run the Terraform pipeline — Full Apply

Run the pipeline again, this time with Plan Only (skip Apply) unticked to actually create the resources.

Run pipeline parameters — Plan Only checkbox unchecked
Uncheck "Plan Only (skip Apply)" — this will run the full Terraform Apply after the Plan

The Dev - Apply stage will require another permission grant. Watch for the warning and click View:

Pipeline stages showing Dev Plan complete and Dev Apply waiting with Permission needed
Dev - Plan completes, then Dev - Apply waits for permission — click View to grant access
Jobs view showing Terraform Apply (Dev) waiting for permission
The Terraform Apply (Dev) job is waiting — grant permission to proceed. The Apply step may take several minutes to complete.
11
Verify resources have been created in Azure

Return to Azure Resource Manager and filter again to confirm the resource group and all resources have been created.

Azure Resource Manager showing are-allergies-dev-ukw-rg-01 resource group created
Resource group are-allergies-dev-ukw-rg-01 now appears in the HSC - RioReimagined - Dev subscription

Open the resource group to confirm all expected resources are present:

Resource group contents showing Key Vault, Application Insights, Container App, Managed Identity, Static Web App
All resources created: Key Vault (UK West), Application Insights (UK West), Container App (UK West), Managed Identity (UK West), Static Web App (West Europe)
Part 4 — Deployment Pipelines
12
Create the Static Web App (SWA) pipeline

Navigate to Deployments > Rio Evo. Create a new folder for your product.

New folder dialog with 'Allergies' entered under Deployments\Rio Evo
Create a new folder named after your product under \Deployments\Rio Evo\
Rio Evo > Allergies folder shown as empty
The new Allergies folder is empty — click "Create a new pipeline here"

Follow the same pipeline creation wizard as Step 7 (Azure Repos Git → select repo → Existing YAML file → select branch). For the YAML path, select:

Path dropdown showing /frontend/azure/build-and-deploy.yml highlighted
Select /frontend/azure/build-and-deploy.yml from the Path dropdown

Press the dropdown arrow next to Run and select Save.

13
Edit the SWA pipeline — disable CI trigger and rename

After saving, click Edit on the pipeline:

Services.Allergies pipeline page with Edit button highlighted
Click the Edit button (top right) to open the pipeline editor

Click the three-dot menu (⋯) and select Triggers:

Pipeline editor menu showing Triggers option
Open the ⋯ menu and select Triggers

Under Continuous integration, tick Override the YAML continuous integration trigger and select Disable continuous integration:

Triggers tab showing Override YAML CI trigger checked and Disable continuous integration selected
Override the YAML CI trigger and set to Disable continuous integration

Rename the pipeline by clicking the pencil icon next to the pipeline name. Add SWA Deploy to the name:

Pipeline breadcrumb showing edit pencil icon next to Services.Allergies name
Click the pencil icon next to the pipeline name to rename it
Pipeline renamed to Services.Allergies SWA Deploy with Save option in dropdown
Rename to e.g. Services.Allergies SWA Deploy, then click Save & queue › Save
14
Create the backend API pipeline

The Allergies folder already exists from the previous step. Right-click it and select New pipeline:

Allergies folder context menu showing New pipeline option
Right-click the Allergies folder and select New pipeline

Follow the same wizard (Azure Repos Git → select repo → Existing YAML file → select branch). For the YAML path, you need /backend/{name}-service/azure/deploy-pipelines.yml. This likely won't appear in the dropdown list and must be entered manually.

Path dropdown showing available YAML files — deploy-pipelines.yml not listed
The deploy-pipelines.yml file may not appear in the list — you'll need to enter the path manually

In VS Code, check if the file exists under backend/allergies-service/azure/:

VS Code file explorer showing backend/allergies-service folder structure without azure subfolder
Check the backend/allergies-service folder — if the azure subfolder or pipeline files don't exist, copy them from another product

If the files don't exist, copy them from another product and edit any references for your service. The azure folder should contain:

VS Code showing backend/allergies-service/azure folder with analysis-pipelines.yml, build-pipelines.yml, deploy-pipelines.yml
The azure folder should contain: analysis-pipelines.yml, build-pipelines.yml, and deploy-pipelines.yml

Commit and sync the pipeline files to your branch:

VS Code Source Control showing 3 staged pipeline YAML files with commit message
Commit the 3 pipeline files: "internal: adding pipeline files #2529301"

Back in Azure DevOps, right-click deploy-pipelines.yml in VS Code and select Copy Relative Path:

VS Code context menu showing Copy Relative Path option for deploy-pipelines.yml
Right-click deploy-pipelines.yml and select Copy Relative Path

Paste the path into the YAML file selector in Azure DevOps:

Select an existing YAML file dialog with backend/allergies-service/azure/deploy-pipelines.yml entered in the Path field
Paste the relative path: backend/allergies-service/azure/deploy-pipelines.yml

Press the dropdown arrow next to Run and select Save. The pipeline breadcrumb should show:

Breadcrumb showing Allergies > Services.Allergies API Deploy
Pipeline saved as: Allergies › Services.Allergies API Deploy
15
Edit the API pipeline — disable CI trigger and rename

Follow the same process as Step 13: Edit → Triggers → Override YAML CI trigger → Disable continuous integration → Rename → Save.

After saving both the SWA Deploy and API Deploy pipelines, you should see both listed under the Allergies folder:

Deployments folder tree showing Rio Evo > Allergies with Services.Allergies API Deploy and SWA Deploy both showing No runs yet
Both deployment pipelines created: Services.Allergies API Deploy and Services.Allergies SWA Deploy — both showing "No runs yet"
Part 5 — Build Pipeline
16
Create the Build pipeline

Navigate to Builds > Rio Evo. Create a new folder for your product.

New folder dialog with 'Allergies' entered under Builds\Rio Evo
Create a new folder named after your product under \Builds\Rio Evo\

Follow the same wizard. For the YAML path, you need /backend/{name}-service/azure/build-pipelines.yml. Right-click the file in VS Code and select Copy Relative Path:

VS Code context menu showing Copy Relative Path for build-pipelines.yml
Right-click build-pipelines.yml and select Copy Relative Path

Paste the path into the YAML file selector:

Select an existing YAML file dialog with backend/allergies-service/azure/build-pipelines.yml in the Path field
Paste the relative path: backend/allergies-service/azure/build-pipelines.yml

Press Save. The pipeline breadcrumb should show:

Breadcrumb showing Allergies > Services.Allergies Build
Pipeline saved as: Allergies › Services.Allergies Build
17
Edit the Build pipeline — disable CI, rename, and add variables

Follow the same process: Edit → Triggers → Override YAML CI trigger → Disable continuous integration → Rename to Services.Allergies Build.

Critical: The pipeline name must match exactly what is referenced on line 14 of /backend/{name}-service/azure/deploy-pipelines.yml. Check that file for the correct value.

Next, go to the Variables tab and add a pipeline variable:

Services.Allergies Build pipeline Variables tab showing system variables and Add button
Click the Variables tab, then click + Add to add a new pipeline variable

Add the following variable:

NameValue
AzureSubscriptionHSC RIOREIMG DEV

Then save using Save & queue → Save:

Save & queue dropdown with Save highlighted — AzureSubscription variable showing HSC RIOREIMG DEV
Confirm the AzureSubscription variable is set to HSC RIOREIMG DEV, then click Save
Part 6 — Running the Pipelines
18
Run the Build pipeline

Run the Build pipeline from your branch. Leave the runtests and runMigrations parameters unchecked for the initial run.

Run pipeline dialog showing branch ADO/2529301/create-environments with runtests and runMigrations parameters unchecked
Select your branch and leave runtests / runMigrations unchecked, then click Run

As with previous pipelines, watch for permission warnings and grant access when prompted:

Pipeline stages showing Stage waiting with Permission needed and Build and Publish Services job
Permission needed — click View and grant access to continue the Build and Publish Services stage

Once the Build stage completes, the Deploy to Dev stage will appear and may also require permission:

Pipeline stages showing Build completed (1 job, 58s, 1 artifact) and Deploy to Dev waiting with Permission needed
Build stage completes (58s, 1 artifact produced) — grant permission for the Deploy to Dev stage
19
Run the Deployments > SWA pipeline

Run the SWA Deploy pipeline from your branch. As with previous pipelines, watch for approval/permit warnings. While only DEV is enabled, it should not prompt to select an environment.

Possible Error: Deploy to Azure Static Web App
"App Directory Location: 'frontend' is invalid. Could not detect this directory."

Solution — edit frontend/azure/build-and-deploy.yml:

Line 44: Change customCommand: 'run build' → customCommand: 'run build:remote'
Line 49: Change targetPath: frontend/dist → targetPath: frontend/build
Lines 85–92: Replace the AzureStaticWebApp@0 task inputs:
# FROM: - task: AzureStaticWebApp@0 inputs: app_location: frontend skip_app_build: true verbose: true azure_static_web_apps_api_token: '$(GetSwaToken.SWA_DEPLOYMENT_TOKEN)' output_location: 'dist' # TO: - task: AzureStaticWebApp@0 inputs: app_location: frontend-dist workingDirectory: $(Pipeline.Workspace) skip_app_build: true skip_api_build: true verbose: true azure_static_web_apps_api_token: '$(GetSwaToken.SWA_DEPLOYMENT_TOKEN)' output_location: ''
20
Configure container port via Devin (before running API pipeline)

Before running the API pipeline, use Devin to set the correct target port on both the Docker configuration and the Container App ingress settings. This prevents the container from failing to start due to port mismatches.

Port note: 8080 is used as an example — ports 80, 8080, 5000, and 5010 have all been used. Check your service's Dockerfile to confirm the correct port.
Devin prompt asking to set target port to 8080 across docker and container app with ingress configuration shown
Send this prompt to Devin (adapted for your repo, branch, and port): set target_port = 8080, external_enabled = true, allow_insecure_connections = false in the ingress block
21
Run the Deployments > API pipeline

Run the API Deploy pipeline from your branch. Leave the artifact as the default on the first run. Watch for permission warnings as with previous pipelines.

Run pipeline dialog showing Services.Allergies Build artifact 0.2.1-2529301-create-environments.3
Run the API pipeline — the Build artifact (e.g. 0.2.1-2529301-create-environments.3) will be pre-selected. Leave as default for the first run.
If the pipeline fails: Check the Deploy API Image step log for port-related errors. The Devin port configuration in Step 20 should have resolved this, but if not, manually update the ingress port setting on the Container App in Azure.
✓
Setup Complete — Summary

At this stage the setup should be complete. Here is a summary of everything that has been done:

TaskStatus
Created a new branch via Devin✓ Done
Cloned the repository to VS Code✓ Done
Generated Terraform scripts via PowerShell scaffold✓ Done
Committed and synced all generated files✓ Done
Created and ran the Terraform pipeline (Plan + Apply)✓ Done
Verified Azure resources created successfully✓ Done
Created the SWA Deploy pipeline (Deployments)✓ Done
Created the API Deploy pipeline (Deployments)✓ Done
Created the Build pipeline (Builds)✓ Done
Ran all 4 pipelines as initial runs✓ Done