Forum Discussion
Azure DevOps + Deployment Pipeline Integration Error
- 10 months ago
I would advise looking to try this in a YAML pipeline instead, using the PowerShell script provided by Microsoft instead of the task.
I have a post that covers how to do that below:
https://www.kevinrchant.com/2024/06/11/update-fabric-deployment-pipeline-stages-with-deploymentpipelines-deployall-and-yaml-pipelines/I hope this helps, if so give it some kudos and/or mark it as the solution.
I would advise looking to try this in a YAML pipeline instead, using the PowerShell script provided by Microsoft instead of the task.
I have a post that covers how to do that below:
https://www.kevinrchant.com/2024/06/11/update-fabric-deployment-pipeline-stages-with-deploymentpipelines-deployall-and-yaml-pipelines/
I hope this helps, if so give it some kudos and/or mark it as the solution.
- LeifB10 months ago
Advocate II
Thanks Kevin, I have been trying to implement this over the past week, just the part that deploys Test to Production. I seem to be stuck though; the second PowerShell script succeeds but outputs the following error: Failed to deploy. Error reponse: {"requestId":"[ID]","errorCode":"InvalidToken","message":"Access token is invalid"}
I set up the authentication with the key vault connection in the variable group as you recommended, and passed the name of the secret into the first PS script, which succeeds. But then it seems like the connection isn't retained when the second script runs. Any suggestions?
- KevinChant10 months ago
Super User
How are you authenticating?
One error I see is when authenticating with PowerShell, because sometime s when using PowerShell in ADO you require quotes.
Try replicating what you are trying to do locally first in PowerShell, if that works test with and without quotes around your secret value.
- LeifB10 months ago
Advocate II
Just a follow-up for anyone who comes across this in the future - we were able to use Kevin's solution, except instead of authenticating in a separate PowerShell step in the pipeline, we added this into the DeploymentPipelines-DeployAll script. We had to pass additional parameters into the script, but the only one not mentioned in Kevin's solution was the Subscription ID. This is the updated SetFabricHeaders function:
function SetFabricHeaders() { # Login to Azure #Connect-AzAccount | Out-Null $SecureStringPwd = ConvertTo-SecureString $SPNSecret -AsPlainText -Force $pscredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $servicePrincipalId, $SecureStringPwd Connect-AzAccount -ServicePrincipal -Credential $pscredential -Tenant $tenantId -Subscription $subscriptionId # Get authentication $fabricToken = Get-AzAccessToken -ResourceUrl $global:resourceUrl $plainToken = [Runtime.InteropServices.Marshal]::PtrToStringAuto( [Runtime.InteropServices.Marshal]::SecureStringToBSTR($fabricToken.Token) ) $global:fabricHeaders = @{ 'Content-Type' = "application/json" 'Authorization' = "Bearer $plainToken" } }