Skip to content

Conversation

adamrtalbot
Copy link
Collaborator

feat: Use Azure Managed identities to download and upload files

When using Managed Identities on Azure Batch, Nextflow still needed to generate a SAS token for the auxiliary files such as the .command.* files. This PR removes that requirement and means Nextflow only uses the managed identity attached to the machine.

It does this by changing the resource file and output properties of the task from a normal URL including a SAS to a URL without a SAS, and configuring the Managed Identity resource ID (ARM) as the authentication.

To do this, we have to perform an additional step where we fetch the resource ID of the managed identity by querying the node pool for available identities and matching them to the client ID. If one does not match, we use the first one as a best guess. Most users should specify a single managed ID or a specific one by client ID, so I think this should be sufficient.

This improves security for Azure Batch and allows users to switch off the ability to create SAS tokens, opening up the use of Nextflow to environments with increased security.

… in Azure Batch

Previously, Azure Batch required SAS tokens to download and upload the resource files (.command.sh and .command.run). This PR adds support for using managed identities to download these files. We use the managed identity specified in the Azure Batch configuration where available, if it's not found it falls back to using a SAS token.

- Add getPoolManagedIdentityResourceId() method to retrieve managed identity from pool
- Modify resourceFileUrls() to use managed identity authentication when available
- Support 'auto' mode to use first available identity or specific client ID
- Fall back to SAS token authentication when managed identity is not available

This allows Azure Batch tasks to download resource files using pool-assigned
managed identities instead of SAS tokens, improving security and eliminating
the need to manage token expiration.

Signed-off-by: adamrtalbot <[email protected]>
Copy link

netlify bot commented Aug 14, 2025

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit d5ab795
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/689dfb6a26ba1d0008b7285c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants