Forum Discussion
Update from Git - Azure Devops Pipeline
- 1 year ago
Hi, MartinMason
Update your pipeline's PowerShell script to use the PAT instead of trying to authenticate via Service Principal.
- powershell: | $pat = "$(PAT)" # Your PAT stored securely in Azure DevOps $headers = @{ Authorization = "Bearer $pat" "Content-Type" = "application/json" } $body = @{ remoteCommitHash = "$(GIT_COMMIT_HASH)" conflictResolution = @{ conflictResolutionType = "Workspace" conflictResolutionPolicy = "PreferWorkspace" } options = @{ allowOverrideItems = $true } } Invoke-RestMethod -Uri "https://api.fabric.microsoft.com/v1/workspaces/$(PBI_WORKSPACE_ID)/git/updateFromGit" -Method Post -Headers $headers -Body ($body | ConvertTo-Json -Compress) displayName: 'Update Power BI Workspace from Git'For now, the PAT approach or interactive user authentication are your best bets to achieve the desired functionality. Both have their pros and cons, but they can enable automated deployments until Microsoft officially supports Service Principal authentication for this endpoint.
Hi, MartinMason
Update your pipeline's PowerShell script to use the PAT instead of trying to authenticate via Service Principal.
- powershell: |
$pat = "$(PAT)" # Your PAT stored securely in Azure DevOps
$headers = @{
Authorization = "Bearer $pat"
"Content-Type" = "application/json"
}
$body = @{
remoteCommitHash = "$(GIT_COMMIT_HASH)"
conflictResolution = @{
conflictResolutionType = "Workspace"
conflictResolutionPolicy = "PreferWorkspace"
}
options = @{
allowOverrideItems = $true
}
}
Invoke-RestMethod -Uri "https://api.fabric.microsoft.com/v1/workspaces/$(PBI_WORKSPACE_ID)/git/updateFromGit" -Method Post -Headers $headers -Body ($body | ConvertTo-Json -Compress)
displayName: 'Update Power BI Workspace from Git'
For now, the PAT approach or interactive user authentication are your best bets to achieve the desired functionality. Both have their pros and cons, but they can enable automated deployments until Microsoft officially supports Service Principal authentication for this endpoint.
I guess you're correct. Seems kinda hackish as the PAT variable value would have to be updated before the pipeline is triggered. Interactive user authentication is not possible as 2FA is enabled for everything in our environment.
I was hoping to trigger the Azure Devops pipeline upon completion of a pull request to master. However, I guess for now, the pipeline will have to be triggered manually and the Power BI access token configured as a required parameter value upon pipeline execution.
- v-nmadadi-msft1 year agoCommunity Support
Hi MartinMason ,
Please check out this link where you can submit the features you would like to have
https://ideas.fabric.microsoft.com/
Consider submiting your feature request if you think that will be helpful.
If you found hackcrr's solution helpful please accept their solution so as to help other community members who may face similar issue in the future.
Thanks and regards