-
Notifications
You must be signed in to change notification settings - Fork 652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate Azure User Identity for credential-less operation on Azure Batch #3314
Comments
A recent change on Azure means that low priority VMs have been replaced on Azure Batch. To use these, Azure Batch accounts must be in User Subscription mode. Once an account is in User Subscription mode, you must use AAD to authenticate, no more keys! This means it is no longer possible to use low-priority VMs on Azure Batch via Nextflow. It's still possible to use dedicated VMs on a Batch account which uses the Batch Service as it's pool allocation mode, but I imagine this is on some sort of deprecation pathway. Long story short, AAD based authentication is pretty critical for continued use of Azure Batch. Thanks for your work so far @abhi18av, I'll happily volunteer some time and energy to testing if you need it. |
Thanks @adamrtalbot , to address the use-case you have highlighted I have already implemented a service principal based auth here #3132 - I'd love to know hear your thoughts if this would address the immediate concerns? The use of User-assigned Identity and Managed Identity would build upon the solution implemented in the indicated PR. |
Thanks @abhi18av, I was getting a bit mixed up with layers of Microsoft AAD. Could the above ticket allow us to run on Azure Batch without any keys? So we could use |
Exactly, that's the plan 💯 Also, just to clarify the Managed Identity solution afaict could only be used from a VM which has been deployed with proper configuration and then NF head job should be able to offload the responsibility of authentication to the VM's own Managed Identity. |
Sounds perfect! |
This comment was marked as off-topic.
This comment was marked as off-topic.
What's missing to achive this? |
@adamrtalbot this is challenge for you 😉 |
@abhi18av did you make any progress on this when you were working on it? If I get a chance I will take another look. |
Hey @adamrtalbot , I assume that what you're aiming for is user/managed identity now right? |
Yup. |
I'm a bit out of touch on this, perhaps we could sync sometime on Monday? Happy to pick this up or guide you through depending on what's needed. |
Okay, here are the things @adamrtalbot and @abhi18av discussed in the meeting today to address the credential-less operations for
|
OK I've managed this, it seems pretty straightforward. Firstly, I made an Azure Batch pool which was the same as the normal Nextflow pools, but with two changes:
and resource file was used this URL: https://aka.ms/downloadazcopy-v10-linux to file After this, you need to set some env variables to tell azcopy to authenticate automatically. This is unique to azcopy but I imagine there would be something similar if we used this system to access the Azure Key Vault to enable secrets. This was pretty straightforward with the I then ran the following Nextflow pipeline. I used Fusion to try and remove any secret azcopy authentication that may have occured. I also ran it on a different batch pool where it failed with this error message:
process AZCOPY {
container 'quay.io/nf-core/ubuntu:20.04'
output:
path("nf-1JnhkGMxTKrBuU.log"), emit: myFile
"""
\$AZ_BATCH_NODE_SHARED_DIR/bin/azcopy copy 'https://account.blob.core.windows.net/path/nf-1JnhkGMxTKrBuU.log' nf-1JnhkGMxTKrBuU.log
cat nf-1JnhkGMxTKrBuU.log
"""
}
workflow {
AZCOPY()
}
All-in-all, it's just a couple of API call changes and updating azcopy, so nothing too troubling. Users will have to create a managed identity with the correct permissions so docs may take a bit longer because it's a bit fiddly. @vsmalladi would you or someone from msft be able to help? Will try Azure Key Vault now. |
Worth mentioning the authentication of storage is not a problem. The use of SAS (temporary) tokens is fair enough. The biggest problem is the authentication for Batch API. |
What's missing from the existing Entra integration? |
As long as you need to share the |
Yes, especially when every other Azure service can be authenticated by calling But these changes would enable more secure storage access, secrets etc. |
#3314 (comment) - thanks @adamrtalbot, I believe that with this we could have this implemented in the default setup too! Also the managed identity solution should work for the use case Paolo mentioned, I just never got around to playing with the Azure Batch configs for this one 🙈 Now that we have some credits, I'll pick this up again and share the updates here 🤞 |
Thanks Abhinav, can we use a managed identity to authenticate with a batch service? I know we can with storage, key vault etc. but didn't think it was possible with Batch. Some googling suggests it is possible but you have to write some code to do it: https://stackoverflow.com/questions/76326790/how-to-use-user-managed-identity-to-access-azure-batchclient-programatically |
Yes, it is possible. From what I can recall with the efforts done in #3132 (comment) I was able to use managed identity and user-assigned identity through some operations on the Azure portal. I decided to focus only on the servicePrincipal at the time since I'll have to poke around in the Git history/branches but I'm sure that this operation was implemented (or sketched out at least) 🤞 |
New feature
There are basically three modes of authentication which we can explore
The user-assigned identity requires certain metadata to be made available to an Azure Resource such as
client ID, Object ID, or Resource ID
but beyond this, is effectively the same as Managed Identity (a user-identity managed by the Azure platform).TLDR; The use of user/managed identity
azcopy login --managed
within.command.run
Identity = SystemAssigned
andStorage account authentication = "BatchAccountManagedIdentity"
Managed/User Identity can be used with all major services which makes sense in Nextflow (and Tower) context such as
Usage scenario
This enhancement would pave the way for a completely credential less deployment of Nextflow on Azure Batch.
Suggest implementation
The foundation of this enhancement would be the
activeDirectory
scope introduced in #3132The text was updated successfully, but these errors were encountered: