SQLPackage.exe publish properties not working as expected

Paul Hernandez 631 Reputation points Microsoft Employee
2021-03-30T13:30:55.247+00:00

Hi everyone,
I am deploying a database project using the generated DACPAC and SQLPackage.

I am facing an unexpected behaviour when excluding object types while publishing.

If I enter the excluded objects using the "plural" property ExcludeObjectTypes, the deployment is failing.

Example (not working):

sqlpackage /Action:Publish /p:ExcludeObjectTypes=Users;Permissions

Error message: Permissions: command not found

However, if I specify the objects individually with the "singular" property, then it works

sqlpackage /Action:Publish /p:ExcludeObjectType=Users /p:ExcludeObjectType=Permissions

I would like to know if I am doing something wrong or there is a bug in the tool.

Target database is a Synapse Analytics SQL Pool Database and SQLPackage version is the latest.

Kind regards,
Paul

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,364 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,696 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tom Phillips 17,716 Reputation points
    2021-03-30T18:14:35.677+00:00

    Try:

    sqlpackage /Action:Publish /p:ExcludeObjectTypes="Users;Permissions"
    

    You are running sqlpackage via PowerShell which uses ; as a command seperator.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Guoxiong 8,126 Reputation points
    2021-03-30T13:51:46.41+00:00

    From the article "SqlPackage Publish parameters, properties, and SQLCMD variables", you can see the difference between ExcludeObjectType and ExcludeObjectTypes. When you try to exclude an object, you should use ExcludeObjectType=Object_Type. If you want to exclude multiple object types, you need to use ExcludeObjectTypes=List_of_Objects_Delimited_by_Semicolon.


  2. CarrinWu-MSFT 6,851 Reputation points
    2021-03-31T03:37:27.24+00:00

    Hi @Paul Hernandez ,

    It seems that this will work find if you use a comma instead of a semicolon-delimited, please try it. Also, you could get more information from this link, see below:
    83082-comma.png

    Best regards,
    Carrin


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.