feat(azure): upgrade azure-mgmt-sql to v3.0.1 and migrate to database_security_alert_policies API #2154
+20
−28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Upgrade
azure-mgmt-sqlfrom<=1.0.0to>=3.0.1and migrate fromdatabase_threat_detection_policiestodatabase_security_alert_policiesAPI.Why is this change necessary?
API Retirement: Microsoft will retire ALL 2014-04-01 REST APIs on June 30, 2026. The current
database_threat_detection_policiesoperation usesapi-version=2014-04-01. If we don't migrate, Cartography's Azure SQL sync will stop working.Ecosystem Compatibility: The constraint
azure-mgmt-sql<=1.0.0conflicts with projects using modern Azure SDK versions (released in the last 4 years), blocking Cartography adoption in the cloud security ecosystem.New Data Available: The modern API provides
creation_timefield useful for auditing and compliance.Changes:
pyproject.tomlazure-mgmt-sql<=1.0.0→>=3.0.1,<4cartography/intel/azure/sql.pydatabase_threat_detection_policies.get()→database_security_alert_policies.get()cartography/models/azure/sql/databasethreatdetectionpolicy.pylocation,kind,useserverdefault(no longer in Azure API); Addcreationtimetests/data/azure/sql.pydocs/root/modules/azure/schema.mduv.lockNote on version constraint: We use
>=3.0.1,<4because azure-mgmt-sql v4 is still in pre-release. The v3.x line will have long-term support, and pinning the upper bound prevents unexpected breaking changes when v4 is eventually released.Note on
uv.lockchanges: Thetyping-extensionsmarker (python_full_version < '3.11') is automatically added by the azure-mgmt-sql package dependencies—not a manual change.Note on removed fields: The fields
location,kind, anduseserverdefaultwere removed by Microsoft from the Azure SQL API in 2021. Existing nodes in Neo4j will retain their old values, only new nodes will lack these fields.Related issues or links
Checklist
Provide proof that this works (this makes reviews move faster). Please perform one or more of the following:
Live Azure Test (azure-mgmt-sql 3.0.1):
Neo4j query result:
If you are changing a node or relationship:
If you are implementing a new intel module: