Skip to content

Audit Action Group is ignored when changing DATABASE AUDIT SPECIFICATION #707

@maciejw

Description

@maciejw
  • SqlPackage or DacFx Version: DacFx 170.2.70
  • .NET Framework (Windows-only) or .NET Core: both
  • Environment (local platform and source/target platforms): windows 11 with sql 2019 developer

Steps to Reproduce:

  1. create sql project and deploy initial database with database audit spec as follows:
    -- create server_audit omitted for simplicity
    CREATE DATABASE AUDIT SPECIFICATION db_audit_spec
    FOR SERVER AUDIT server_audit
    ADD (DATABASE_OBJECT_CHANGE_GROUP)
    WITH (STATE = ON)

  2. modify database audit spec object in a project and deploy database
    CREATE DATABASE AUDIT SPECIFICATION db_audit_spec
    FOR SERVER AUDIT server_audit
    ADD (SCHEMA_OBJECT_CHANGE_GROUP)
    WITH (STATE = ON)

db_audit_spec will not be modified. audit_action_group_name are ignored by compare logic, thus DATABASE AUDIT SPECIFICATION cannot be changed, you have to drop it in target db first, and create it again, because its only created correctly when there is no object in target db. I checked with STATE ON and OFF, because with STATE ON, object cannot be altered, it made no difference.
when check ComparisonResult it a deployment contributor the change is visible in ElementsChanged and in ElementsComposingChildrenChanged, but definition of AuditActionGroup is empty, there is no step in a deployment plan corresponding with this change also.

My expectation is the following script

  • handle state of db_audit_spec if needed
  • alter db_audit_spec, add or drop correct audit object groups
  • handle state of db_audit_spec if needed

Did this occur in prior versions? If not - which version(s) did it work in?
YES
(DacFx and Visual Studio ssdt compare)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions