I’m encountering an ‘unrecognized arguments: --federated-token’ error when creating a pipeline using the Microsoft/MLOpsPython repository in Azure DevOps. When I attempt to run the CI pipeline, this error appears. ChatGPT suggested updating the CLI version, but I’m uncertain if this will resolve the issue. Has anyone successfully created a complete end-to-end MLOps pipeline using this repository template in Azure DevOps? I would like to know what necessary changes are required to overcome this error and successfully implement the pipeline.
The “unrecognized arguments: --federated-token” error typically occurs because your Azure CLI version doesn’t support the federated token authentication parameter or due to misconfigured Workload Identity Federation settings in Azure DevOps. While updating your Azure CLI version might help, the complete solution requires proper configuration of Workload Identity Federation and service connections in Azure Devops, which has been successfully implemented by many users with the Microsoft/MLOpsPython repository.
Contents
- Understanding the Federated Token Error
- Root Causes and Solutions
- Step-by-Step Fix Implementation
- Successful End-to-End MLOps Pipeline Setup
- Verification and Testing
- Best Practices and Troubleshooting
Understanding the Federated Token Error
The “unrecognized arguments: --federated-token” error occurs when Azure CLI commands in your pipeline attempt to use the --federated-token parameter, but either:
- Your Azure CLI version is outdated and doesn’t support this parameter
- The federated token authentication isn’t properly configured in your Azure DevOps service connection
- There’s a mismatch between the issuer URL or federation subject in your federated identity credential
According to the Microsoft Azure DevOps documentation, this error specifically indicates that “Your federation identity credentials are misconfigured or the Microsoft Entra tenant blocks OpenID Connect (OIDC).”
The Microsoft/MLOpsPython repository uses Azure DevOps pipelines that leverage Workload Identity Federation for secure authentication, which is a modern approach that eliminates the need to store service principal secrets in your pipeline configuration.
Root Causes and Solutions
Primary Root Causes
1. Outdated Azure CLI Version
- The
--federated-tokenparameter was introduced in Azure CLI versions 2.30.0 and later - If your pipeline environment has an older version, it won’t recognize this argument
2. Misconfigured Workload Identity Federation
- The service connection in Azure DevOps might not be properly set up with Workload Identity Federation
- The issuer URL might not match the expected format (should start with
https://login.microsoftonline.com/)
3. Service Principal Issues
- The service principal might be expired, revoked, or have insufficient permissions
- The federated identity credential might not be properly associated with the service principal
Immediate Solutions
Update Azure CLI
# In your pipeline, add this step before Azure CLI tasks
- task: AzureCLI@2
displayName: 'Update Azure CLI'
inputs:
azureSubscription: 'your-service-connection'
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
az upgrade
az --version
Configure Workload Identity Federation
As recommended in the Microsoft Q&A, you need to:
- Edit your Azure Resource Manager service connection under Project Settings → Service connections
- Switch it to Workload Identity Federation (manual)
Step-by-Step Fix Implementation
Step 1: Update Azure CLI in Pipeline Environment
Add the following task to your pipeline before any Azure CLI operations:
- task: AzureCLI@2
displayName: 'Upgrade Azure CLI'
inputs:
azureSubscription: 'your-service-connection-name'
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
echo "Upgrading Azure CLI..."
az upgrade --yes
az --version
Step 2: Configure Workload Identity Federation in Azure DevOps
- Navigate to your Azure DevOps project
- Go to Project Settings → Service connections
- Select your existing Azure Resource Manager service connection
- Click Edit
- Under Authentication method, select Workload Identity Federation
- Ensure the Issuer URL starts with
https://login.microsoftonline.com/ - Click Save to apply the changes
Important: As noted in the Azure troubleshooting guide, “If you see a message that indicates no matching federated identity record found, either the issuer URL or the federation subject doesn’t match.”
Step 3: Update Pipeline YAML for Federated Token Usage
Modify your Azure CLI tasks to properly handle federated token authentication:
- task: AzureCLI@2
displayName: 'Azure Login with Federated Token'
inputs:
azureSubscription: 'your-workload-identity-connection'
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
az login --debug --federated-token "$(cat $AZURE_FEDERATED_TOKEN_FILE)" --service-principal -u $AZURE_CLIENT_ID -t $AZURE_TENANT_ID
addSpnToEnvironment: true
This approach, as shown in the Stack Overflow solution, properly handles the federated token file and environment variables.
Successful End-to-End MLOps Pipeline Setup
Complete Configuration Process
Based on successful implementations documented in the Microsoft MLOps repository and various tutorials, here’s the complete setup process:
1. Repository Setup
- Clone the Microsoft/MLOpsPython repository:bash
git clone https://github.com/microsoft/MLOpsPython.git cd MLOpsPython
2. Azure DevOps Project Configuration
- Create a new Azure DevOps project or connect your existing repository
- Ensure you have the necessary Azure subscription permissions
3. Service Principal and Federated Identity Setup
# Create a service principal in Azure
az ad sp create-for-rbac --name "mlops-sp" --role contributor --scopes /subscriptions/your-subscription-id
# Note down the following values:
# Application (client) ID
# Directory (tenant) ID
# Client Secret (for initial setup)
4. Workload Identity Federation Configuration
As described in the Firefly Academy guide, federated identity “eliminates these problems by using OpenID Connect (OIDC).”
5. Pipeline Configuration
The Microsoft/MLOpsPython repository provides pre-built pipeline templates that you can customize. The key is ensuring all Azure CLI tasks use the updated version and proper federated token authentication.
Real-World Implementation Example
According to user experiences documented in Microsoft Q&A, successful implementation involves:
- Properly configuring the service connection with Workload Identity Federation
- Ensuring the deployment tasks are pointed at the federated connection
- Validating that the pipeline presents a valid federated token
- Confirming proper ARM access token reception
Verification and Testing
Pipeline Validation Steps
1. Test Azure CLI Version
az --version
# Should show version 2.30.0 or higher
2. Federated Token Authentication Test
- task: AzureCLI@2
displayName: 'Test Federated Token Authentication'
inputs:
azureSubscription: 'your-workload-identity-connection'
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
az account show
echo "Federated token authentication successful"
3. End-to-End Pipeline Run
- Trigger a full pipeline run from the Microsoft/MLOpsPython template
- Monitor for the federated token error
- Verify that all Azure ML and DevOps integration steps complete successfully
Common Validation Checks
- Ensure your Azure DevOps organization has the necessary permissions for Workload Identity Federation
- Verify that the service principal has the correct roles and permissions
- Check that the federated identity credential is properly associated with the service principal
- Confirm that the pipeline environment variables are correctly set
Best Practices and Troubleshooting
Best Practices for MLOps Pipeline Success
1. Version Management
- Keep Azure CLI updated to the latest stable version
- Use consistent versions across all pipeline environments
- Regularly update Azure DevOps extensions and tasks
2. Security Configuration
- Use Workload Identity Federation instead of stored credentials
- Implement proper RBAC for service principals
- Regularly rotate and validate federated identity credentials
3. Pipeline Optimization
- Use parallel processing where possible
- Implement proper logging and monitoring
- Set up automated testing for pipeline changes
Troubleshooting Continued Issues
If you continue to experience federated token issues:
1. Debug Mode
- task: AzureCLI@2
displayName: 'Debug Azure CLI Login'
inputs:
azureSubscription: 'your-service-connection'
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
az login --debug --federated-token "$(cat $AZURE_FEDERATED_TOKEN_FILE)" --service-principal -u $AZURE_CLIENT_ID -t $AZURE_TENANT_ID
2. Check Environment Variables
echo "AZURE_FEDERATED_TOKEN_FILE: $AZURE_FEDERATED_TOKEN_FILE"
echo "AZURE_CLIENT_ID: $AZURE_CLIENT_ID"
echo "AZURE_TENANT_ID: $AZURE_TENANT_ID"
3. Validate Federation Configuration
As per the Azure troubleshooting guide, verify that “the issuer of the service account token matches the issuer you defined in the federated identity credential.”
Conclusion
The “unrecognized arguments: --federated-token” error in Microsoft/MLOpsPython pipelines can be successfully resolved by following a systematic approach:
- Update Azure CLI to version 2.30.0 or higher to support federated token authentication
- Configure Workload Identity Federation properly in Azure DevOps service connections
- Update pipeline YAML to use correct federated token authentication syntax
- Validate all configurations through testing and debugging steps
Many users have successfully implemented complete end-to-end MLOps pipelines using the Microsoft/MLOpsPython repository by following these configuration steps. The key is ensuring that all Azure CLI tasks are compatible with the federated token authentication method and that the Workload Identity Federation is properly set up in Azure DevOps.
For ongoing success, maintain regular updates to your CLI tools and monitor Microsoft’s documentation for any changes to federated authentication requirements. The Microsoft MLOpsPython repository provides an excellent foundation that, with proper configuration, can deliver robust CI/CD pipelines for machine learning workflows.
Sources
- Microsoft Azure DevOps - Getting unrecognized arguments: federated-token in MLOpsPython pipeline
- Microsoft Learn - AZURE_FEDERATED_TOKEN not injected in pipeline using Workload Identity Federation
- Microsoft Learn - Troubleshoot workload identity service connections
- Microsoft Azure DevOps Documentation - Workload Identity Federation troubleshooting
- Azure Workload Identity Documentation - Troubleshooting
- Microsoft MLOpsPython GitHub Repository - End-to-end MLOps pipeline implementation
- Firefly Academy - Integrating Federated Identity Credentials with Azure DevOps
- Microsoft Q&A - Workload Identity Federation successful implementation
- Stack Overflow - Azure Pipelines logging in using Workload Identity Federation
- MLOps Python Tutorial - End to end MLOps implementation