Deploy to test devices with a Robopatch flow
A manual upload creates the app in Intune without assigning it to anyone. To get an app onto test devices automatically, deploy it through a Robopatch flow. The flow takes its deployment waves from a patch group, so the first wave can target your test devices before the app reaches anyone else.
The API creates flows and deployments but not patch groups or waves. Set up the patch group in the portal first, then use the API for each app.
This guide uses PowerShell and the ROBOPACK_API_KEY environment variable from Getting started. The API user needs the Upload apps permission on the tenant; see Authentication and permissions.
The POST requests below create a flow and start a deployment, which creates the app and its assignments in Intune. Use a patch group whose first wave targets a small test group.
Set up the patch group in the portal
Create a patch group whose first wave targets an Entra ID group of test devices, and whose later waves cover the wider rollout. Follow Creating a patch group, and see Automating App Updates for how to plan the waves.
Find the patch group ID
No endpoint lists patch groups, but every flow returns the patchGroupId of the group it belongs to. Add one app to the patch group in the portal, then read the ID from its flow:
if ([string]::IsNullOrWhiteSpace($env:ROBOPACK_API_KEY)) {
throw 'Set ROBOPACK_API_KEY to your API key.'
}
$headers = @{ 'X-API-Key' = $env:ROBOPACK_API_KEY; Accept = 'application/json' }
$flows = @(Invoke-RestMethod -Method Get -Headers $headers -ErrorAction Stop `
-Uri 'https://api.robopack.com/v1/flow?DisablePaging=false&ItemsPerPage=50')
$flows | Select-Object name, patchGroupName, patchGroupId | Format-Table -AutoSize
$patchGroupId = Read-Host 'Enter the patchGroupId of the patch group you reviewed'
Create the flow
Create the flow with either an Instant App ID from Search Instant Apps or a package ID from Create a custom package, not both:
$body = @{
packageId = $packageId
patchGroupId = $patchGroupId
} | ConvertTo-Json
$flowId = Invoke-RestMethod -Method Post -Headers $headers -ErrorAction Stop `
-ContentType 'application/json' -Body $body `
-Uri 'https://api.robopack.com/v1/flow/create'
$flowId
For an Instant App, send appId in place of packageId. The response is the new flow's ID as a JSON UUID string. The flow inherits the patch group's waves and settings; without a patchGroupId, the flow is created empty.
The flow create reference also documents name, scope, templateId, supersedenceHistoryCount and flags.
Add and start a deployment
Read the flow to see whether it already has a deployment:
$flow = Invoke-RestMethod -Method Get -Headers $headers -ErrorAction Stop `
-Uri "https://api.robopack.com/v1/flow/$flowId"
$flow.deployments | Select-Object id, version, state, isActive, packageId | Format-Table -AutoSize
If it has none, add one for a completed package and start it straight away:
$body = @{ packageId = $packageId; startNow = $true } | ConvertTo-Json
$deploymentId = Invoke-RestMethod -Method Post -Headers $headers -ErrorAction Stop `
-ContentType 'application/json' -Body $body `
-Uri "https://api.robopack.com/v1/flow/$flowId/add-deployment"
The response is the deployment ID. To add the deployment now and start it later, set startNow to false and call POST /v1/flow/deployment/{id}/start when you are ready.
Result: Robopack uploads the app to Intune in the background and assigns it to the first wave's group. Read the deployment with GET /v1/flow/deployment/{id} to see when the upload has finished.
Check the test wave
Follow Monitor Robopatch flows to read the current wave and its live install data from Intune. The deployment moves to the next wave when the test wave's thresholds are met, as described in How the wave thresholds are calculated.
To move on before the thresholds are met, call POST /v1/flow/deployment/{id}/skip-wave. To halt the rollout, call POST /v1/flow/deployment/{id}/stop. Both are in the deployment reference.