Azure Batch compute environment setup
This guide details how to set up an Azure Batch and Seqera Cloud account to run a workflow in a Seqera Azure Batch compute environment.
Seqera Platform now provisions most advanced Azure Batch topologies natively through Batch Forge, including separate head and worker pools, dedicated head job resources, autoscaling, Entra authentication, and private networking. This tutorial walks the native Batch Forge path end-to-end, then covers the cases that still require a manually created pool.
For a field-by-field reference of every compute environment option, see Azure Batch.
Prerequisites
- An Azure account with sufficient permissions to create resources.
- Azure CLI
- Seqera Platform CLI
Set up Azure Batch
In the Azure Portal:
- Create an Azure Storage account with the default settings.
- In the Azure Storage account, add a single blob container called
work. This is the Nextflow working directory. - Create a new Azure Batch account. Use Batch Managed for now, with the default settings. Use the same region as your Storage account and attach the Storage account to the Batch account when prompted.
- On the Azure Batch page, select Quotas.
- Select Request Quota Increase.
- For Quota Type, select Batch, then select Next.
- Select Enter Details, then choose the Location as the region of your Batch account.
- Select EDv5 Series.
- Select Active jobs and job schedules per Batch account.
- Select Pools per Batch account.
Increase each value to a minimum of the following:
- EDv5 Series: 192
- Active jobs and job schedules per Batch account: 100
- Pools per Batch account: 50
Set up Seqera Cloud
In Seqera Cloud:
- Create a new account.
- Create a new organization and workspace.
- Add a GitHub credential to the workspace to prevent API rate-limiting issues with GitHub.
Part 1. Azure Batch with Batch Forge
Batch Forge creates and manages the Azure Batch pools for you. By default it creates separate pools for the Nextflow head job and compute tasks (named tower-pool-{envId}-head and tower-pool-{envId}-worker), so the head node does not compete with tasks for resources and each pool can be sized independently. Both pools autoscale based on the number of waiting tasks.
First, add the Azure Batch account credentials to Seqera Platform:
- In the Azure portal, go to the Batch account you created and note the Batch account name and region.
- Go to the Keys tab to find the primary access keys for the Batch account and Storage account.
- In your Seqera Platform workspace, go to the Credentials tab and select Add credentials.
- Enter a credential name such as
azure-keysand select Azure from the Provider drop-down. - Enter the Batch account name and key, and Storage account name and key.
- Select Create to save the credentials.
Next, create a compute environment with Batch Forge:
- Go to the Compute Environments tab and select Add Compute Environment.
- Enter a name such as
azure-batch-forge. - Select Azure Batch from the Provider drop-down.
- Select your
azure-keyscredentials. - Select the Region of your Batch account.
- Select the
az://workcontainer in your Storage account. - Set Config mode to Batch Forge.
- For VMs type, select
standard_e2ds_v5. - For VMs count, select 4.
- Enable Autoscale and Dispose resources.
- (Optional) Under Head job resources, set a separate Head VM type, Head job CPUs, and Head job memory to size the head node independently of the compute tasks.
- All other options can be left default. Select Create to save the compute environment.
To reduce pipeline latency, disable Autoscale on the head pool so a head node stays running (fixed scale). Set VMs count to 1 for the head pool. This incurs additional cost for the always-on node but improves response time, which is more noticeable on larger production pipelines.
Add the nextflow-hello pipeline to your workspace:
Add a pipeline from your workspace Launchpad with the following settings:
- Select your Azure Batch compute environment from the drop-down.
- For Pipeline to launch, enter
https://github.com/nextflow-io/hello. - For Work directory, enter a subdirectory in the
az://workcontainer in your Storage account.
Select Launch next to the pipeline name in your workspace Launchpad to complete the launch form and launch the workflow.
Part 2. Use Entra authentication
Advantages:
- No keys or short access tokens are exchanged, increasing security.
- A service principal can have very granular permissions, so you can grant it only the permissions it needs.
- Managed identities can be scoped to a specific resource, so the Nextflow head job has very restricted permissions.
- Different managed identities can have different permissions, so different compute environments can have different scoped permissions.
Instead of access keys, Seqera can authenticate to Azure Batch and Storage using an Entra service principal, and Nextflow can authenticate using a managed identity. Batch Forge configures the pool identity for you. You create the service principal and managed identity in Azure, then select them in the compute environment form.
See Microsoft Entra in the Nextflow documentation for more information.
Create a service principal for Seqera to use for authentication
- Create an Azure service principal.
- Assign roles to the service principal.
- Get the Service Principal ID, Tenant ID, and Client Secret.
- Add to Seqera credentials
In Seqera:
- Add new credentials with the name
entra-keysand select the Azure Provider. - Add the Service Principal ID, Tenant ID and Client Secret.
- Select Create to save the credentials.
Create a managed identity for Nextflow to use for authentication
In the Azure Portal:
- Create a managed identity
- Assign the relevant roles to the managed identity. See Required role assignments for Nextflow requirements.
- Note the managed identity client ID for later.
In Seqera:
- Add a new Batch Forge compute environment named
entra-miand select the Azure Batch Provider type. - For Credentials, select the
entra-keysservice principal credentials. - For Location, select the same region as your Batch account.
- Under the managed identity fields, enter the client ID of the managed identity created earlier.
- Configure the remaining fields as in Part 1.
Duplicate the nextflow-hello pipeline, save it as hello-world-entra-mi, and select the new compute environment.
Select Launch next to the hello-world-entra-mi pipeline in your workspace Launchpad to complete the launch form and launch the workflow. The pipeline runs as before, but uses the managed identity to authenticate to Azure Batch and Storage. No keys are exchanged.
Part 3. Attach the pool to a virtual network (VNet)
Advantages:
- Security can be increased by restricting the virtual network subnet.
- Exchange of data can be faster and cheaper than routing over the public internet.
To connect the Batch pool nodes to a private Azure VNet, enter a Subnet ID when creating the Batch Forge compute environment. Batch Forge attaches the subnet to both the head and worker pools, so worker nodes inherit the same networking automatically.
VNet/subnet configuration requires Entra credentials. The Subnet ID field is only available when Entra credentials are selected. See Entra service principal and managed identity in the Azure Batch reference.
-
Add a new Batch Forge compute environment named
azure-batch-vnetand select the Azure Batch Provider type. -
For Credentials, select the
entra-keysservice principal credentials. -
For Location, select the same region as your Batch account.
-
For Subnet ID, enter the full Azure ARM subnet resource ID:
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName} -
Configure the remaining fields as in Part 1.
Duplicate the nextflow-hello pipeline, save it as hello-world-vnet, and select the new compute environment. Select Launch to run the workflow on the pool attached to the VNet.
Advanced. Use a pre-existing Azure Batch pool
Some scenarios still require a manually created pool, such as custom VM images or Azure Batch features that Batch Forge does not expose. In these cases, create the pool yourself and select it in a Manual compute environment.
See Create a Nextflow-compatible Azure Batch pool in the Azure Batch reference for the full pool configuration (identity, OS image, autoscale formula, start task, and networking), then create a Manual compute environment that points at the pool name.
The Nextflow autopool feature (azure.batch.autoPoolMode and azure.batch.allowPoolCreation) is deprecated and not used by Seqera Platform. Use the Batch Forge separate-pool model described above instead.
Clear up resources
Once you have completed setup and workflow execution, you can delete the pipelines and compute environments from Seqera.
In Azure, you can delete the Batch account, which will delete all pools, jobs, and tasks. You can then delete the Storage account.
If you wish to keep the Azure resources, you can remove each pool within a Batch account and mark any active jobs as terminated to free up any quotas on your Azure Batch account.