Workload Identity Federation -Azure Synapse Release pipeline Fails with Error

Prabhu 65 Reputation points
2025-06-13T11:56:23.5133333+00:00

We;re creating a release pipeline for Azure Synapse using

WIF for automatic connection and everything works fine ( Verified Permissions on the SPN) however when running the release pipeline Getting this error .

025-06-13T11:42:41.3876045Z An error occurred during execution: Error: Get workspace location error: Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired. For more information refer https://aka.ms/azureappservicedeploytsg
2025-06-13T11:42:41.3903578Z ##[error]Encountered with exception:Error: Get workspace location error: Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired. For more information refer https://aka.ms/azureappservicedeploytsg
Azure DevOps
{count} vote

1 answer

Sort by: Most helpful
  1. ArkoSen-6842 4,165 Reputation points Moderator
    2025-06-16T06:15:56.0166667+00:00

    Hello Prabhu,

    The root cause of your issue is that the Azure Synapse deployment task does not currently support Workload Identity Federation authentication. Even though your service connection is configured with WIF correctly and the Service Principal has valid federated credentials, the underlying deployment task attempts to retrieve an access token using the legacy ServicePrincipal credential flow, which fails in WIF-based contexts with the error

    Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired.

    To resolve this issue, you should switch from the Synapse GUI task to an AzureCLI@2 task, which fully supports WIF and can deploy Synapse artifacts using Azure PowerShell or REST APIs. In order to replace Synapse task with AzureCLI@2, create a new Azure CLI task in your release pipeline

    - task: AzureCLI@2
      inputs:
        azureSubscription: 'synapse-serviceconnection' # your WIF-based service connection
        scriptType: 'ps'
        scriptLocation: 'inlineScript'
        inlineScript: |
          # Authenticate and deploy Synapse ARM Template
          $resourceGroup = 'rg-dibber-global-analytics-prod'
          $workspaceName = 'synapse-global-analytics-prod'
          $templatePath = "$(System.DefaultWorkingDirectory)/_YourArtifact/drop/template.json"
          $parametersPath = "$(System.DefaultWorkingDirectory)/_YourArtifact/drop/parameters.json"
          az deployment group create `
            --resource-group $resourceGroup `
            --template-file $templatePath `
            --parameters @$parametersPath `
            --name synapseDeployment-$(Build.BuildId)
    

    Just ensure your synapse-serviceconnection is set up with WIF and the Federated Credential in Entra ID has issuer: https://vstoken.azure.net

    If you must use the Synapse Deployment Task UI in the future, please note that Microsoft currently does not support WIF for that task. Until an updated task version is released with WIF support, using the AzureCLI@2 task is the most reliable and secure workaround.

    you can checkout below MS docs-
    Set up Workload Identity Federation for Azure DevOps

    Troubleshoot WIF token fetch issues

    az deployment group create reference


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.