Blog Post

Azure Database Support Blog
1 MIN READ

Lesson Learned #213: Cannot set the AccessToken property if the Integrated Security has been set

Jose_Manuel_Jurado's avatar
Jul 01, 2022

Today, I worked on a service request where using SQLPackage and Azure Active Directory user our customer got the following error message "Error exporting database:Could not connect to database server. Cannot set the AccessToken property if the 'Integrated Security' connection string keyword has been set to 'true' or 'SSPI'."

 

Our customer is executing the following command to export the data using SQLPackage "sqlpackage.exe /Action:Export /ssn:tcp:servername.database.windows.net,1433 /sdn:"DbName" /ua:true /tid:"mydomain.com" /tf:"C:\ExportFile.bacpac"  /p:Storage=File  /df:"C:\diag.txt

 

After validating the AAD user we got the following error message: 

 

  • Connecting to database 'DbName' on server 'tcp:servername.database.windows.net,1433'.
  • *** Error exporting database:Could not connect to database server.
  • Cannot set the AccessToken property if the 'Integrated Security' connection string keyword has been set to 'true' or 'SSPI'.

 

All points to that after AAD validation SQLPackage has in the connection string "Integrated Security=true" that is not compatible with AAD validation. In this situation, we changed the execution of SQLPackage specifying directly a connection string setting Integrated Security=false on that, using this following example:  sqlpackage.exe /Action:Export /SourceConnectionString:"data source=tcp:servername.database.windows.net,1433;Initial Catalog=DbName;Integrated Security=false" /ua:true /tid:"mydomain.com" /tf:"c:\ExportFile.bacpac" /p:Storage=File /df:"c:\diag.txt"

 

After it, our customer was able to export the data using AAD user.

 

Enjoy!

Published Jul 01, 2022
Version 1.0