Skip to content

Commit 092cdc5

Browse files
authored
Merge pull request #111251 from ajlam/auditlogcli
audit log CLI
2 parents e8a4dd7 + 4e918f9 commit 092cdc5

File tree

6 files changed

+121
-4
lines changed

6 files changed

+121
-4
lines changed

articles/mariadb/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@
156156
items:
157157
- name: Azure portal
158158
href: howto-configure-audit-logs-portal.md
159+
- name: Azure CLI
160+
href: howto-configure-audit-logs-cli.md
159161
- name: Monitor
160162
items:
161163
- name: Create alerts on metrics
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
title: Access audit logs - Azure CLI - Azure Database for MariaDB
3+
description: This article describes how to configure and access the audit logs in Azure Database for MariaDB from the Azure CLI.
4+
author: ajlam
5+
ms.author: andrela
6+
ms.service: mariadb
7+
ms.topic: conceptual
8+
ms.date: 4/13/2020
9+
---
10+
11+
# Configure and access audit logs in the Azure CLI
12+
13+
You can configure the [Azure Database for MariaDB audit logs](concepts-audit-logs.md) from the Azure CLI.
14+
15+
> [!IMPORTANT]
16+
> Audit log functionality is currently in preview.
17+
18+
## Prerequisites
19+
20+
To step through this how-to guide, you need:
21+
22+
- [Azure Database for MariaDB server](quickstart-create-mariadb-server-database-using-azure-portal.md)
23+
24+
[!INCLUDE [cloud-shell-try-it.md](../../includes/cloud-shell-try-it.md)]
25+
26+
> [!IMPORTANT]
27+
> This how-to guide requires that you use Azure CLI version 2.0 or later. To confirm the version, at the Azure CLI command prompt, enter `az --version`. To install or upgrade, see [Install Azure CLI]( /cli/azure/install-azure-cli).
28+
29+
## Configure audit logging
30+
31+
Enable and configure audit logging using the following steps:
32+
33+
1. Turn on audit logs by setting the **audit_logs_enabled** parameter to "ON".
34+
```azurecli-interactive
35+
az mariadb server configuration set --name audit_log_enabled --resource-group myresourcegroup --server mydemoserver --value ON
36+
```
37+
38+
1. Select the [event types](concepts-audit-logs.md#configure-audit-logging) to be logged by updating the **audit_log_egitvents** parameter.
39+
```azurecli-interactive
40+
az mariadb server configuration set --name audit_log_events --resource-group myresourcegroup --server mydemoserver --value "ADMIN,CONNECTION"
41+
```
42+
43+
1. Add any MariaDB users to be excluded from logging by updating the **audit_log_exclude_users** parameter. Specify users by providing their MariaDB user name.
44+
```azurecli-interactive
45+
az mariadb server configuration set --name audit_log_exclude_users --resource-group myresourcegroup --server mydemoserver --value "azure_superuser"
46+
```
47+
48+
1. Add any specific MariaDB users to be included for logging by updating the **audit_log_include_users** parameter. Specify users by providing their MariaDB user name.
49+
```azurecli-interactive
50+
az mariadb server configuration set --name audit_log_include_users --resource-group myresourcegroup --server mydemoserver --value "sampleuser"
51+
```
52+
53+
## Next steps
54+
55+
- Learn more about [audit logs](concepts-audit-logs.md) in Azure Database for MariaDB
56+
- Learn how to configure audit logs in the [Azure portal](howto-configure-audit-logs-portal.md)

articles/mariadb/howto-configure-audit-logs-portal.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: ajlam
55
ms.author: andrela
66
ms.service: mariadb
77
ms.topic: conceptual
8-
ms.date: 3/18/2020
8+
ms.date: 4/13/2020
99
---
1010

1111
# Configure and access audit logs in the Azure portal
@@ -65,4 +65,5 @@ Enable and configure audit logging.
6565

6666
## Next steps
6767

68-
- Learn more about [audit logs](concepts-audit-logs.md) in Azure Database for MariaDB.
68+
- Learn more about [audit logs](concepts-audit-logs.md) in Azure Database for MariaDB
69+
- Learn how to configure audit logs in the [Azure CLI](howto-configure-audit-logs-cli.md)

articles/mysql/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@
204204
items:
205205
- name: Azure portal
206206
href: howto-configure-audit-logs-portal.md
207+
- name: Azure CLI
208+
href: howto-configure-audit-logs-cli.md
207209
- name: Monitor
208210
items:
209211
- name: Create alerts on metrics
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: Access audit logs - Azure CLI - Azure Database for MySQL
3+
description: This article describes how to configure and access the audit logs in Azure Database for MySQL from the Azure CLI.
4+
author: ajlam
5+
ms.author: andrela
6+
ms.service: mysql
7+
ms.topic: conceptual
8+
ms.date: 4/13/2020
9+
---
10+
11+
# Configure and access audit logs in the Azure CLI
12+
13+
You can configure the [Azure Database for MySQL audit logs](concepts-audit-logs.md) from the Azure CLI.
14+
15+
> [!IMPORTANT]
16+
> Audit log functionality is currently in preview.
17+
18+
## Prerequisites
19+
20+
To step through this how-to guide, you need:
21+
22+
- [Azure Database for MySQL server](quickstart-create-mysql-server-database-using-azure-portal.md)
23+
24+
[!INCLUDE [cloud-shell-try-it.md](../../includes/cloud-shell-try-it.md)]
25+
26+
> [!IMPORTANT]
27+
> This how-to guide requires that you use Azure CLI version 2.0 or later. To confirm the version, at the Azure CLI command prompt, enter `az --version`. To install or upgrade, see [Install Azure CLI]( /cli/azure/install-azure-cli).
28+
29+
## Configure audit logging
30+
31+
Enable and configure audit logging using the following steps:
32+
33+
1. Turn on audit logs by setting the **audit_logs_enabled** parameter to "ON".
34+
```azurecli-interactive
35+
az mysql server configuration set --name audit_log_enabled --resource-group myresourcegroup --server mydemoserver --value ON
36+
```
37+
38+
1. Select the [event types](concepts-audit-logs.md#configure-audit-logging) to be logged by updating the **audit_log_events** parameter.
39+
```azurecli-interactive
40+
az mysql server configuration set --name audit_log_events --resource-group myresourcegroup --server mydemoserver --value "ADMIN,CONNECTION"
41+
```
42+
43+
1. Add any MySQL users to be excluded from logging by updating the **audit_log_exclude_users** parameter. Specify users by providing their MySQL user name.
44+
```azurecli-interactive
45+
az mysql server configuration set --name audit_log_exclude_users --resource-group myresourcegroup --server mydemoserver --value "azure_superuser"
46+
```
47+
48+
1. Add any specific MySQL users to be included for logging by updating the **audit_log_include_users** parameter. Specify users by providing their MySQL user name.
49+
```azurecli-interactive
50+
az mysql server configuration set --name audit_log_include_users --resource-group myresourcegroup --server mydemoserver --value "sampleuser"
51+
```
52+
53+
## Next steps
54+
- Learn more about [audit logs](concepts-audit-logs.md) in Azure Database for MySQL
55+
- Learn how to configure audit logs in the [Azure portal](howto-configure-audit-logs-portal.md)

articles/mysql/howto-configure-audit-logs-portal.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: ajlam
55
ms.author: andrela
66
ms.service: mysql
77
ms.topic: conceptual
8-
ms.date: 3/18/2020
8+
ms.date: 4/13/2020
99
---
1010

1111
# Configure and access audit logs for Azure Database for MySQL in the Azure portal
@@ -65,4 +65,5 @@ Enable and configure audit logging.
6565

6666
## Next steps
6767

68-
- Learn more about [audit logs](concepts-audit-logs.md) in Azure Database for MySQL.
68+
- Learn more about [audit logs](concepts-audit-logs.md) in Azure Database for MySQL
69+
- Learn how to configure audit logs in the [Azure CLI](howto-configure-audit-logs-cli.md)

0 commit comments

Comments
 (0)