Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 7 commits into from
Jan 8, 2024

Conversation

ParthaI
Copy link
Contributor

@ParthaI ParthaI commented Dec 29, 2023

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.

@ParthaI ParthaI self-assigned this Dec 29, 2023
Copy link
Contributor

@madhushreeray30 madhushreeray30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ParthaI Please take a look at the comments, thanks!

azure/table_azure_sql_database.go Outdated Show resolved Hide resolved
azure/table_azure_sql_database.go Outdated Show resolved Hide resolved
azure/table_azure_sql_database.go Outdated Show resolved Hide resolved
azure/table_azure_sql_server.go Outdated Show resolved Hide resolved
azure/table_azure_sql_server.go Outdated Show resolved Hide resolved
azure/table_azure_sql_server.go Outdated Show resolved Hide resolved
@madhushreeray30 madhushreeray30 merged commit b1a39ea into main Jan 8, 2024
1 check passed
@madhushreeray30 madhushreeray30 deleted the issue-709 branch January 8, 2024 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add audit_policy detail in table azure_sql_database and azure_sql_server
2 participants