microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.49k stars 2.61k forks source link

SqlAzureDacpacDeployment: service principal authentication doesn't work for export action #17820

Open JESUS-PEREZ opened 1 year ago

JESUS-PEREZ commented 1 year ago

Required Information

Question, Bug, or Feature?
Type: Bug

Enter Task Name: SqlAzureDacpacDeployment@1

Environment

Issue Description

"SqlAzureDacpacDeployment" is not working when using service principal authentication for Export action, while it correctly works for Import action. Running the same command ("C:\Program Files\Microsoft SQL Server\150\DAC\bin\SqlPackage.exe" /Action:Export /TargetFile:"C:\XXXX.bacpac" /SourceServerName:"tcp:XXXX.database.windows.net,1433" /SourceDatabaseName:"XXXX" /AccessToken:"****" ) from Azure CLI works fine too.

This is the task configuration:

- task: SqlAzureDacpacDeployment@1
   displayName: Export DB
   inputs:
     azureSubscription: ${{ parameters.azureSubscription }}
     AuthenticationType: "servicePrincipal"
     ServerName: "tcp:$(databaseFQDN),1433"
     DatabaseName: $(databaseName)
     deployType: DacpacTask
     DeploymentAction: Export

Error logs

"C:\Program Files\Microsoft SQL Server\150\DAC\bin\SqlPackage.exe" /Action:Export /TargetFile:"C:\agent-01\_work\127\s\GeneratedOutputFiles\XXXX.bacpac" /SourceServerName:"tcp:XXXX.database.windows.net,1433" /SourceDatabaseName:"XXXX" /AccessToken:"********" 

Connecting to database 'XXXX' on server 'tcp:XXXX.database.windows.net,1433'.
Time elapsed 00:00:00.79
##[error]*** An unexpected failure occurred: Exception has been thrown by the target of an invocation..
##[error]The Azure SQL DACPAC task failed. SqlPackage.exe exited with code 1.Check out how to troubleshoot failures at https://aka.ms/sqlazuredeployreadme#troubleshooting-
jkonecki commented 1 year ago

I'm experiencing the same issue. Are there any valid workarounds?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

jkonecki commented 1 year ago

Adding a comment to keep the issue open

On Mon, 11 Sept 2023, 01:20 github-actions[bot], @.***> wrote:

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

— Reply to this email directly, view it on GitHub https://github.com/microsoft/azure-pipelines-tasks/issues/17820#issuecomment-1712986139, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANRND52QEAWSMIXDXN374LXZZKNXANCNFSM6AAAAAAVG35LOA . You are receiving this because you commented.Message ID: @.***>

github-actions[bot] commented 7 months ago

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

jkonecki commented 7 months ago

Adding a comment to keep the issue open


From: github-actions[bot] @.> Sent: 10 March 2024 15:06 To: microsoft/azure-pipelines-tasks @.> Cc: Jakub Konecki @.>; Comment @.> Subject: Re: [microsoft/azure-pipelines-tasks] SqlAzureDacpacDeployment: service principal authentication doesn't work for export action (Issue #17820)

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/azure-pipelines-tasks/issues/17820#issuecomment-1987262869, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AANRND5VSEF5DE4CDAJBJATYXRZFVAVCNFSM6AAAAAAVG35LOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBXGI3DEOBWHE. You are receiving this because you commented.Message ID: @.***>