turbot / steampipe-plugin-azure

Use SQL to instantly query Azure resources across regions and subscriptions. Open source CLI. No DB required.
https://hub.steampipe.io/plugins/turbot/azure
Apache License 2.0
35 stars 16 forks source link

Add audit_policy detail in table azure_sql_database and azure_sql_server Closes #709 #711

Closed ParthaI closed 6 months ago

ParthaI commented 6 months ago

Integration test logs

Logs ``` Add passing integration test logs here ```

Example query results

Results ``` > select name, jsonb_pretty(audit_policy) from azure_sql_database +-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | name | jsonb_pretty | +-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | test-db23 | [ | | | { | | | "id": "/subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbot_rg/providers/Microsoft.Sql/servers/test43/databases/test-db23/auditingSettings/Default", | | | "name": "Default", | | | "type": "Microsoft.Sql/servers/databases/auditingSettings", | | | "databaseBlobAuditingPolicyProperties": { | | | "state": "Enabled", | | | "retentionDays": 0, | | | "storageEndpoint": "https://demobac6.blob.core.windows.net/", | | | "AuditActionsAndGroups": [ | | | "SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP", | | | "FAILED_DATABASE_AUTHENTICATION_GROUP", | | | "BATCH_COMPLETED_GROUP" | | | ], | | | "isStorageSecondaryKeyInUse": false, | | | "isAzureMonitorTargetEnabled": false, | | | "storageAccountSubscriptionID": "3510ae4d-530b-497d-8f30-53b9616fc6c1" | | | } | | | }, | | | { | | | "id": "/subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbot_rg/providers/Microsoft.Sql/servers/test43/databases/test-db23/auditingSettings/Default", | | | "name": "Default", | | | "type": "Microsoft.Sql/servers/databases/auditingSettings", | | | "databaseBlobAuditingPolicyProperties": { | | | "state": "Enabled", | | | "retentionDays": 0, | | | "storageEndpoint": "https://demobac6.blob.core.windows.net/", | | | "AuditActionsAndGroups": [ | | | "SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP", | | | "FAILED_DATABASE_AUTHENTICATION_GROUP", | | | "BATCH_COMPLETED_GROUP" | | | ], | | | "isStorageSecondaryKeyInUse": false, | | | "isAzureMonitorTargetEnabled": false, | | | "storageAccountSubscriptionID": "3510ae4d-530b-497d-8f30-53b9616fc6c1" | | | } | | | } | | | ] | | master | [ | | | { | | | "id": "/subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbot_rg/providers/Microsoft.Sql/servers/test43/databases/master/auditingSettings/Default", | | | "name": "Default", | | | "type": "Microsoft.Sql/servers/databases/auditingSettings", | | | "databaseBlobAuditingPolicyProperties": { | | | "state": "Disabled", | | | "retentionDays": 0, | | | "isAzureMonitorTargetEnabled": false, | | | "storageAccountSubscriptionID": "00000000-0000-0000-0000-000000000000" | | | } | | | }, | | | { | | | "id": "/subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbot_rg/providers/Microsoft.Sql/servers/test43/databases/master/auditingSettings/Default", | | | "name": "Default", | | | "type": "Microsoft.Sql/servers/databases/auditingSettings", | | | "databaseBlobAuditingPolicyProperties": { | | | "state": "Disabled", | | | "retentionDays": 0, | | | "isAzureMonitorTargetEnabled": false, | | | "storageAccountSubscriptionID": "00000000-0000-0000-0000-000000000000" | | | } | | | } | | | ] | +-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Time: 51ms. Rows fetched: 2 (cached). Hydrate calls: 0. > select name, jsonb_pretty(audit_policy) from azure_sql_server +--------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+ | name | jsonb_pretty | +--------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+ | test43 | [ | | | { | | | "id": "/subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbot_rg/providers/Microsoft.Sql/servers/test43/auditingSettings/Default", | | | "name": "Default", | | | "type": "Microsoft.Sql/servers/auditingSettings", | | | "serverBlobAuditingPolicyProperties": { | | | "state": "Disabled", | | | "retentionDays": 0, | | | "storageEndpoint": "", | | | "AuditActionsAndGroups": [ | | | ], | | | "isStorageSecondaryKeyInUse": false, | | | "isAzureMonitorTargetEnabled": false, | | | "storageAccountSubscriptionID": "00000000-0000-0000-0000-000000000000" | | | } | | | }, | | | { | | | "id": "/subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbot_rg/providers/Microsoft.Sql/servers/test43/auditingSettings/Default", | | | "name": "Default", | | | "type": "Microsoft.Sql/servers/auditingSettings", | | | "serverBlobAuditingPolicyProperties": { | | | "state": "Disabled", | | | "retentionDays": 0, | | | "storageEndpoint": "", | | | "AuditActionsAndGroups": [ | | | ], | | | "isStorageSecondaryKeyInUse": false, | | | "isAzureMonitorTargetEnabled": false, | | | "storageAccountSubscriptionID": "00000000-0000-0000-0000-000000000000" | | | } | | | } | | | ] | +--------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+ Time: 1.2s. Rows fetched: 1. Hydrate calls: 1. ```