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

This post has been republished via RSS; it originally appeared at: Azure Database Support Blog articles.

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!

REMEMBER: these articles are REPUBLISHED. Your best bet to get a reply is to follow the link at the top of the post to the ORIGINAL post! BUT you're more than welcome to start discussions here:

This site uses Akismet to reduce spam. Learn how your comment data is processed.