Share via

Microsoft Fabric API Authentication & Deployment Issue | Azure DevOps Pipeline

Suki Azure 136 Reputation points
2025-03-11T13:50:24.8933333+00:00

Dear All,

We have configured Microsoft Fabric in our environment, with dedicated workspaces for Dev, UAT, and PROD. Instead of using Deployment Pipelines, we have integrated our workspaces with an Azure DevOps Git repository branch for version control.

Current Implementation

We are using the Fabric API to trigger deployments: 🔗 API Endpoint: https://api.fabric.microsoft.com/v1/workspaces/$WorkspaceId/git/updateFromGit

Initially, we used a service account for deployments. While testing via Postman, we were able to retrieve all workspace IDs, but the deployment API returned the following error:

{

Actions Taken

  • Followed Microsoft documentation to create an Application ID and Client Secret.
  • Granted the following permissions to the App:
    • Workspace.ReadWrite.All
    • Workspace.GitUpdate
  • Added the App ID as a Workspace Admin.

Issue with API Token Authentication

When running the following PowerShell script in our Azure DevOps pipeline to generate an access token, we faced an authentication issue while retrieving workspace IDs or deploying contents:

Pipeline Script for Token Generation

powershell
CopyEdit
$TenantId = "$(TENANT_ID)"
$ClientId = "$(CLIENT_ID)"
$ClientSecret = "$(CLIENT_SECRET)"
$TokenUrl = "https://login.microsoftonline.com/$TenantId/oauth2/v2.0/token"

$Body = @{
    client_id     = $ClientId
    client_secret = $ClientSecret
    scope         = "https://api.fabric.microsoft.com/.default"
    grant_type    = "client_credentials"
}

try {
    $Response = Invoke-RestMethod -Uri $TokenUrl -Method Post -Body $Body -ContentType "application/x-www-form-urlencoded"
    $AccessToken = $Response.access_token

    if (-not $AccessToken) {
        Write-Host "##[error]Failed to fetch Access Token!"
        exit 1
    }

    Write-Host "Access Token (First 10 chars): $($AccessToken.Substring(0,10))..."
    Write-Host "##vso[task.setvariable variable=FabricAccessToken;isSecret=true]$AccessToken"
} catch {
    Write-Host "##[error]Failed to retrieve access token: $_"
    exit 1
}

Err{ "requestId": "29bcee65-1313-4103-bcb6-56d7e572ec27", "errorCode": "Unauthorized", "message": "The caller is not authenticated to access this resource" }

Azure Data Factory
Azure Data Factory

An Azure service for ingesting, preparing, and transforming data at scale.


1 answer

Sort by: Most helpful
  1. Smaran Thoomu 35,285 Reputation points Microsoft External Staff Moderator
    2025-03-11T17:03:38.7833333+00:00

    Hi @Suki Azure

    MS Fabric is currently not supported in the Q&A forums, the supported products are listed over here Supported products on MS Q&A (more to be added later on).

    You can ask the experts in the dedicated MS Fabric community forum.

    Can you please open as a new thread in MS Fabric community: https://community.fabric.microsoft.com/t5/General-Discussion/bd-p/ac_generaldiscussion

    Hope this helps. Do let us know if you any further queries.

    Was this answer helpful?


Your answer

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