I have a azure ci/cd pipeline and it failed due to json index issue not supported. I checked my project and there is no json index in my database project

JingJing Gao 5 Reputation points
2025-10-20T21:43:28.97+00:00

The error message is :##[error]*** An error occurred during deployment plan generation. Deployment cannot continue.

##[error]Error SQL72018: SqlJsonIndex could not be imported but one or more of these objects exist in your source.

##[error]System.Management.Automation.RemoteException

##[error]Errors occurred while modeling the target database. Deployment can not continue.

But I don't have any json index in my code and now it involved multiple CI/CD pipelines.

Azure SQL Database
{count} vote

3 answers

Sort by: Most helpful
  1. Swapnesh Panchal 750 Reputation points Microsoft External Staff Moderator
    2025-10-24T20:56:55.1566667+00:00

    Hi @JingJing Gao, thanks for the details. A few new things to try that often resolve SQL72018: SqlJsonIndex even when your code has none:

    1. Prove what’s inside the DACPAC (new) • Download the built .dacpac, rename to .zip, open model.xml, and search for JsonIndex / SqlJsonIndex. • If found, it’s being injected during build (not from the target DB). Share the small <JsonIndex …> block if you see it.
    2. Correct the exclude switch (new: plural + exact spelling) In YAML AdditionalArguments, use the plural form exactly:
    /p:ExcludeObjectTypes=JsonIndexes /p:AllowIncompatiblePlatform=True
    

    (Your screenshot shows JsonIndex singular—DacFx ignores that.)

    1. Lock the provider/tooling (new) • Print the versions used by the agent:
    SqlPackage /Version
    dotnet --info
    

    • Update to the latest DacFx/SqlPackage on the agent or bump the “Azure SQL Dacpac Deployment” task to its newest major. Mismatched DacFx can light up JSON index types in the model.

    1. Pin the project target (new) In the .sqlproj, set
    <TargetPlatform>Microsoft.Data.Tools.Schema.Sql.AzureV12DatabaseSchemaProvider</TargetPlatform>
    

    or choose “Microsoft Azure SQL Database (V12)” in VS. Then Clean and Rebuild. Building against higher providers (e.g., v160) can surface JSON index artifacts even if you don’t author them.

    1. Isolate references (new) If you reference other DACPACs (master/custom), temporarily remove them and rebuild. One of them may carry a JSON index into your model.
    2. Sanity check on target (you already ran)
    SELECT * FROM sys.json_indexes;
    

    It’s fine if this returns zero—this error is usually about the model.

    If it still fails, please share: • The exact AdditionalArguments line you now use (with JsonIndexes plural),

    SqlPackage /Version from the build log,

    • The <TargetPlatform> line from .sqlproj,

    • Any <JsonIndex …> snippet found in model.xml.

    With those, we can pinpoint which step is injecting SqlJsonIndex and give a precise fix.

    0 comments No comments

  2. Sina Salam 25,931 Reputation points Volunteer Moderator
    2025-10-28T18:22:20.33+00:00

    Hello JingJing Gao,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you're having an azure CI/CD pipeline and it failed due to JSON index issue not supported.

    Your DACPAC model generated during the build process, where newer DacFx or SqlPackage versions silently introduce JSON index elements into the model. To resolve this, the first critical step is to inspect your generated .dacpac file before deployment. Copy and rename the file extension to .zip, extract it, and open the model.xml file. Search for <JsonIndex> or SqlJsonIndex entries; if they exist, these are the actual causes of the failure. Removing them at build time ensures your deployment package is clean.

    NOTE: There is a clear difference between publish and build models. The next to do is to add the correct exclusion parameters when publishing. Use the plural /p:ExcludeObjectTypes=JsonIndexes (not singular) along with /p:AllowIncompatiblePlatform=True to ensure unsupported objects are ignored during deployment. For an example:

    SqlPackage.exe /Action:Publish /SourceFile:"$(Pipeline.Workspace)/MyDb.dacpac" `
      /TargetConnectionString:"$(connectionString)" `
      /p:ExcludeObjectTypes=JsonIndexes /p:AllowIncompatiblePlatform=True
    

    If you are using the Azure SQL Dacpac Deployment task, add the same arguments to AdditionalArguments in your YAML or classic pipeline. - Check this reference: SqlPackage publish parameters.

    If the problem persists because the DACPAC itself contains these entries, you can exclude them during the build stage by passing /p:ExcludeObjectTypes=JsonIndexes as an MSBuild argument or by removing any referenced DACPACs that inject JSON index metadata. For example:

    - task: MSBuild@1   
    inputs:     
    solution: '**/*.sqlproj'     
    msbuildArguments: '/t:Build /p:ExcludeObjectTypes=JsonIndexes'
    

    You should also review your .sqlproj file and ensure the <TargetPlatform> matches your Azure SQL target and for an example in xml:

    <TargetPlatform>Microsoft.Data.Tools.Schema.Sql.AzureV12DatabaseSchemaProvider</TargetPlatform>

    Mismatched target platforms or incompatible schema providers can cause DacFx to generate unsupported objects. Check this reference: Database project target platforms.

    Finally, verify your tooling versions by running:

    SqlPackage /Version
    dotnet --info
    
    

    If the issue began after a recent update, it could be due to a DacFx regression; consider rolling back or pinning to a stable version. Check related DacFx issues are tracked here: GitHub DacFx Issues.

    After implementing these steps, rebuild and redeploy your project, confirming that no <JsonIndex> entries remain in model.xml and that publish logs show no SQL72018 errors. This approach not only resolves your immediate deployment failure but also ensures consistent, stable CI/CD behavior across multiple database projects and pipeline runs.

    I hope this is helpful! Do not hesitate to let me know if you have any other questions or clarifications.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.


  3. TechnicianTate 6 Reputation points
    2025-10-30T18:23:52.0466667+00:00

    Found a solution, I had to manually downgrade sqlpackage.exe using a self hosted build agent.

    • 170.2.70 does not work.
    • downgrading to 170.0.94 does work.

    Note that I had been relying on Azure hosted agents and there was no solution for those short of installing 170.0.94 each run via PS script and manually specifying that old copy to run the job with because I was unable to replace the pre-installed copy of 170.2.70. (I tried this approach and ran into unrelated issues and pivoted to a self hosted agent)

    link to SQLpackage downloads for new and old versions:
    https://free.blessedness.top/en-us/sql/tools/sqlpackage/release-notes-sqlpackage?view=sql-server-ver17

    -follow up complaint-
    I am annoyed with MSFT support in 2 ways, my own support case which is going nowhere, and in the below thread because they closed it as not a bug when it obviously is a bug if we have to regress versions of sqlpackage for normal operations.
    https://developercommunity.visualstudio.com/t/SqlJsonIndex-could-not-be-imported/10985887?ftype=problem&stateGroup=active&sort=newest

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.